- remove the exp trend
- on the ramining signal, use zero crossing detection to compute cycle to cycle period (and therefore the instantaneaous frequency of a sinus signal)
- to fit that, compute a sine signal with the period / amplitude observed in step 2
Damped cosine features in a exponential decay
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kunjanni
am 4 Nov. 2020
Kommentiert: Star Strider
am 5 Nov. 2020
Hi Guys,
I am trying to fit a decay curve which has some oscillatory feature in the decay. I tried to fit the data with the sum of a exponential with cosine function but didn't succed. Any help would be appreciated. I attached file here (column 1 is time and column 2 is the corresponding intensities).
Thanks and regards,
2 Kommentare
Mathieu NOE
am 4 Nov. 2020
hello
I plotted your data
seems the data and the structure of the fit model will not match...
even by mentally removing the exponential trend, the remaining oscillations have variable amplitude and period as time goes... it will be tricky to find a combination of sinusoidal function that fits this portion of the signal
maybe a solution :
Akzeptierte Antwort
Star Strider
am 5 Nov. 2020
This produces a reasonable approximation, however the signal appears to be changing its frequency toward the end:
D = load('Ampf.mat');
t = D.Ampf(:,1);
s = D.Ampf(:,2);
s = detrend(s,7);
yu = max(s);
yl = min(s);
yr = (yu-yl); % Range of ‘y’
yz = s-yu+(yr/2);
zt = t(yz(:) .* circshift(yz(:),[1 0]) <= 0); % Find zero-crossings
per = 2*mean(diff(zt)); % Estimate period
ym = mean(s); % Estimate offset
fit = @(b,x) b(1) .* exp(b(2).*x) .* (sin(2*pi*x./b(3) + 2*pi/b(4))) + b(5); % Objective Function to fit
fcn = @(b) norm(fit(b,t) - s); % Least-Squares cost function
B = fminsearch(fcn, [yr; -1; per; -1; ym]) % Minimise Least-Squares
xp = linspace(min(t),max(t));
yp = fit(B,xp);
figure
plot(t, s, '-p')
hold on
plot(xp, yp, '-r')
hold off
grid
It may be necessary to change ‘fit’ to something more closely approximating the process that produced your data. Retain the detrending step in the code.
2 Kommentare
Star Strider
am 5 Nov. 2020
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!