find fitting equation and parameters to fit damped oscillations curves from set of data

5 views (last 30 days)
I am trying to fit my data (bellow) to a damped oscillations curve, I can't determine the fitting equation, because it's not easy.
I don't know if it's even possible to do it, without knowing the fitting equation, and the most important is finding the parameters for this fitting.
x30= [1.40E+04 1.40E+04 1.41E+04 1.41E+04 1.42E+04 1.42E+04 1.42E+04 1.43E+04 1.43E+04 1.43E+04 1.44E+04 1.44E+04 1.45E+04 1.45E+04 1.45E+04 1.46E+04 1.46E+04 1.46E+04 1.47E+04 1.47E+04 1.48E+04 1.48E+04 1.48E+04 1.49E+04 1.49E+04 1.49E+04 1.50E+04 1.50E+04 1.51E+04 1.51E+04 1.51E+04 1.52E+04 1.52E+04 1.53E+04 1.53E+04 1.53E+04 1.54E+04 1.54E+04 1.54E+04 1.55E+04 15521.13777 15559.45668 15597.79092 15636.14029 1.57E+04 1.57E+04 1.58E+04 1.58E+04 1.58E+04 1.59E+04 1.59E+04 1.59E+04 1.60E+04 1.60E+04 1.61E+04 1.61E+04 1.61E+04 1.62E+04 1.62E+04 1.63E+04 1.63E+04 1.63E+04 1.64E+04 1.64E+04 1.64E+04 1.65E+04 1.65E+04 1.66E+04 1.66E+04 1.66E+04 1.67E+04 1.68E+04 1.69E+04 1.70E+04 1.71E+04 1.72E+04 1.73E+04 1.74E+04 1.75E+04 1.76E+04 1.77E+04 1.78E+04 1.79E+04 1.80E+04 1.81E+04 1.82E+04 1.83E+04 1.84E+04 1.85E+04 1.86E+04 1.87E+04 1.88E+04 1.89E+04 1.90E+04 1.91E+04 1.91E+04 1.92E+04 1.93E+04 1.94E+04 1.95E+04 1.96E+04 1.97E+04 1.98E+04 1.99E+04 2.00E+04 2.01E+04 2.02E+04 2.03E+04 2.04E+04 20512.09298 20609.50662 20706.9258 20804.34834 20901.7768 20999.22015 21096.67455 21194.13379 21291.59834 21389.06623 21486.53808 21584.02386 21681.52239 21779.02615 21876.53569 21974.04901 22071.56586 22169.09515 22266.63918 22364.18951 22461.7455 22559.30577 22656.8689 22754.44281 22852.03143 22949.62642 23047.2266 23144.83138 23242.43867 23340.05445 23437.6868 23535.32846 23632.97578 23730.6286 23828.28439 23925.94739 24023.62551 24121.31208 24219.00331 24316.69957 24414.39881 24512.10282 24609.82226 24707.55504 24805.29389 24903.03895 ]
Slope30 = [ -3.55E-06 -5.52E-06 -3.96E-06 -2.94E-06 -4.54E-06 -3.28E-06 -3.00E-06 -4.32E-06 -4.08E-06 -3.59E-06 -3.82E-06 -3.70E-06 -3.55E-06 -3.23E-06 -2.03E-06 -2.52E-06 -3.89E-06 -4.25E-06 -3.95E-06 -3.83E-06 -3.42E-06 -3.01E-06 -2.50E-06 -2.12E-06 -2.07E-06 -2.34E-06 -2.97E-06 -3.52E-06 -3.87E-06 -3.85E-06 -3.34E-06 -2.93E-06 -2.83E-06 -2.33E-06 -1.74E-06 -2.00E-06 -2.61E-06 -2.32E-06 -2.05E-06 -2.90E-06 -3.83E-06 -4.08E-06 -3.48E-06 -3.20E-06 -1.89E-06 -7.26E-07 -1.88E-06 -2.48E-06 -2.59E-06 -1.27E-06 -7.86E-07 -3.29E-06 -4.32E-06 -2.73E-06 -2.27E-06 -3.85E-06 -3.93E-06 -1.62E-06 -1.50E-06 -3.07E-06 -1.13E-06 -4.50E-07 -2.52E-06 -1.27E-06 -1.04E-06 -3.51E-06 -1.98E-06 -1.51E-06 4.72E-05 0.000298027 -0.000468594 -0.001470947 -0.001476212 -0.001213067 -0.000780846 -0.000501233 -0.000356343 -0.000248914 -0.000182324 -0.000150969 -0.00013269 -0.000102512 -8.25E-05 -8.26E-05 -6.45E-05 -5.90E-05 -5.18E-05 -3.23E-05 -4.96E-05 -4.07E-05 -1.29E-05 -2.82E-05 -3.70E-05 -1.20E-05 7.40E-06 -5.13E-06 -2.71E-05 -2.28E-05 -4.30E-06 8.62E-06 3.01E-06 -1.38E-05 -1.55E-05 -4.66E-06 7.66E-06 1.62E-05 6.76E-06 -1.25E-05 -1.61E-05 -5.46E-06 6.31E-06 1.36E-05 5.88E-06 -1.10E-05 -1.35E-05 -4.49E-06 5.74E-06 1.42E-05 9.33E-06 -8.89E-06 -1.53E-05 -6.31E-06 4.68E-06 1.37E-05 1.26E-05 -3.62E-06 -1.46E-05 -9.11E-06 1.07E-06 1.06E-05 1.14E-05 -2.25E-06 -1.53E-05 -1.08E-05 1.53E-06 1.19E-05 1.76E-05 4.64E-06 -1.31E-05 -1.33E-05 -3.67E-06 6.79E-06 1.21E-05 8.66E-07 -1.38E-05 -1.23E-05 -1.32E-06 1.00E-05 1.82E-05 1.19E-05 -7.78E-06 -1.51E-05 -7.22E-06 2.52E-06 1.00E-05]
Thanks in advance for your help !
  2 Comments
Sam Chak
Sam Chak on 23 Sep 2022
Can you clarify if you really want to fit this signal?
I'm not if there is an analytical equation exists for this curve.
I'm unsure, but the signal looks like a response from a non-minimum phase system.
x30 = [1.40E+04 1.40E+04 1.41E+04 1.41E+04 1.42E+04 1.42E+04 1.42E+04 1.43E+04 1.43E+04 1.43E+04 1.44E+04 1.44E+04 1.45E+04 1.45E+04 1.45E+04 1.46E+04 1.46E+04 1.46E+04 1.47E+04 1.47E+04 1.48E+04 1.48E+04 1.48E+04 1.49E+04 1.49E+04 1.49E+04 1.50E+04 1.50E+04 1.51E+04 1.51E+04 1.51E+04 1.52E+04 1.52E+04 1.53E+04 1.53E+04 1.53E+04 1.54E+04 1.54E+04 1.54E+04 1.55E+04 15521.13777 15559.45668 15597.79092 15636.14029 1.57E+04 1.57E+04 1.58E+04 1.58E+04 1.58E+04 1.59E+04 1.59E+04 1.59E+04 1.60E+04 1.60E+04 1.61E+04 1.61E+04 1.61E+04 1.62E+04 1.62E+04 1.63E+04 1.63E+04 1.63E+04 1.64E+04 1.64E+04 1.64E+04 1.65E+04 1.65E+04 1.66E+04 1.66E+04 1.66E+04 1.67E+04 1.68E+04 1.69E+04 1.70E+04 1.71E+04 1.72E+04 1.73E+04 1.74E+04 1.75E+04 1.76E+04 1.77E+04 1.78E+04 1.79E+04 1.80E+04 1.81E+04 1.82E+04 1.83E+04 1.84E+04 1.85E+04 1.86E+04 1.87E+04 1.88E+04 1.89E+04 1.90E+04 1.91E+04 1.91E+04 1.92E+04 1.93E+04 1.94E+04 1.95E+04 1.96E+04 1.97E+04 1.98E+04 1.99E+04 2.00E+04 2.01E+04 2.02E+04 2.03E+04 2.04E+04 20512.09298 20609.50662 20706.9258 20804.34834 20901.7768 20999.22015 21096.67455 21194.13379 21291.59834 21389.06623 21486.53808 21584.02386 21681.52239 21779.02615 21876.53569 21974.04901 22071.56586 22169.09515 22266.63918 22364.18951 22461.7455 22559.30577 22656.8689 22754.44281 22852.03143 22949.62642 23047.2266 23144.83138 23242.43867 23340.05445 23437.6868 23535.32846 23632.97578 23730.6286 23828.28439 23925.94739 24023.62551 24121.31208 24219.00331 24316.69957 24414.39881 24512.10282 24609.82226 24707.55504 24805.29389 24903.03895];
Slope30 = [ -3.55E-06 -5.52E-06 -3.96E-06 -2.94E-06 -4.54E-06 -3.28E-06 -3.00E-06 -4.32E-06 -4.08E-06 -3.59E-06 -3.82E-06 -3.70E-06 -3.55E-06 -3.23E-06 -2.03E-06 -2.52E-06 -3.89E-06 -4.25E-06 -3.95E-06 -3.83E-06 -3.42E-06 -3.01E-06 -2.50E-06 -2.12E-06 -2.07E-06 -2.34E-06 -2.97E-06 -3.52E-06 -3.87E-06 -3.85E-06 -3.34E-06 -2.93E-06 -2.83E-06 -2.33E-06 -1.74E-06 -2.00E-06 -2.61E-06 -2.32E-06 -2.05E-06 -2.90E-06 -3.83E-06 -4.08E-06 -3.48E-06 -3.20E-06 -1.89E-06 -7.26E-07 -1.88E-06 -2.48E-06 -2.59E-06 -1.27E-06 -7.86E-07 -3.29E-06 -4.32E-06 -2.73E-06 -2.27E-06 -3.85E-06 -3.93E-06 -1.62E-06 -1.50E-06 -3.07E-06 -1.13E-06 -4.50E-07 -2.52E-06 -1.27E-06 -1.04E-06 -3.51E-06 -1.98E-06 -1.51E-06 4.72E-05 0.000298027 -0.000468594 -0.001470947 -0.001476212 -0.001213067 -0.000780846 -0.000501233 -0.000356343 -0.000248914 -0.000182324 -0.000150969 -0.00013269 -0.000102512 -8.25E-05 -8.26E-05 -6.45E-05 -5.90E-05 -5.18E-05 -3.23E-05 -4.96E-05 -4.07E-05 -1.29E-05 -2.82E-05 -3.70E-05 -1.20E-05 7.40E-06 -5.13E-06 -2.71E-05 -2.28E-05 -4.30E-06 8.62E-06 3.01E-06 -1.38E-05 -1.55E-05 -4.66E-06 7.66E-06 1.62E-05 6.76E-06 -1.25E-05 -1.61E-05 -5.46E-06 6.31E-06 1.36E-05 5.88E-06 -1.10E-05 -1.35E-05 -4.49E-06 5.74E-06 1.42E-05 9.33E-06 -8.89E-06 -1.53E-05 -6.31E-06 4.68E-06 1.37E-05 1.26E-05 -3.62E-06 -1.46E-05 -9.11E-06 1.07E-06 1.06E-05 1.14E-05 -2.25E-06 -1.53E-05 -1.08E-05 1.53E-06 1.19E-05 1.76E-05 4.64E-06 -1.31E-05 -1.33E-05 -3.67E-06 6.79E-06 1.21E-05 8.66E-07 -1.38E-05 -1.23E-05 -1.32E-06 1.00E-05 1.82E-05 1.19E-05 -7.78E-06 -1.51E-05 -7.22E-06 2.52E-06 1.00E-05];
plot(x30, Slope30)

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 23 Sep 2022
I can approximate the fit, however not to the oscillations.
The best model is a mathematical model of the process that created those data, not necessarily the one I created (for no reason other than it seems to be a logical choice).
Try this —
x30= [1.40E+04 1.40E+04 1.41E+04 1.41E+04 1.42E+04 1.42E+04 1.42E+04 1.43E+04 1.43E+04 1.43E+04 1.44E+04 1.44E+04 1.45E+04 1.45E+04 1.45E+04 1.46E+04 1.46E+04 1.46E+04 1.47E+04 1.47E+04 1.48E+04 1.48E+04 1.48E+04 1.49E+04 1.49E+04 1.49E+04 1.50E+04 1.50E+04 1.51E+04 1.51E+04 1.51E+04 1.52E+04 1.52E+04 1.53E+04 1.53E+04 1.53E+04 1.54E+04 1.54E+04 1.54E+04 1.55E+04 15521.13777 15559.45668 15597.79092 15636.14029 1.57E+04 1.57E+04 1.58E+04 1.58E+04 1.58E+04 1.59E+04 1.59E+04 1.59E+04 1.60E+04 1.60E+04 1.61E+04 1.61E+04 1.61E+04 1.62E+04 1.62E+04 1.63E+04 1.63E+04 1.63E+04 1.64E+04 1.64E+04 1.64E+04 1.65E+04 1.65E+04 1.66E+04 1.66E+04 1.66E+04 1.67E+04 1.68E+04 1.69E+04 1.70E+04 1.71E+04 1.72E+04 1.73E+04 1.74E+04 1.75E+04 1.76E+04 1.77E+04 1.78E+04 1.79E+04 1.80E+04 1.81E+04 1.82E+04 1.83E+04 1.84E+04 1.85E+04 1.86E+04 1.87E+04 1.88E+04 1.89E+04 1.90E+04 1.91E+04 1.91E+04 1.92E+04 1.93E+04 1.94E+04 1.95E+04 1.96E+04 1.97E+04 1.98E+04 1.99E+04 2.00E+04 2.01E+04 2.02E+04 2.03E+04 2.04E+04 20512.09298 20609.50662 20706.9258 20804.34834 20901.7768 20999.22015 21096.67455 21194.13379 21291.59834 21389.06623 21486.53808 21584.02386 21681.52239 21779.02615 21876.53569 21974.04901 22071.56586 22169.09515 22266.63918 22364.18951 22461.7455 22559.30577 22656.8689 22754.44281 22852.03143 22949.62642 23047.2266 23144.83138 23242.43867 23340.05445 23437.6868 23535.32846 23632.97578 23730.6286 23828.28439 23925.94739 24023.62551 24121.31208 24219.00331 24316.69957 24414.39881 24512.10282 24609.82226 24707.55504 24805.29389 24903.03895 ];
Slope30 = [ -3.55E-06 -5.52E-06 -3.96E-06 -2.94E-06 -4.54E-06 -3.28E-06 -3.00E-06 -4.32E-06 -4.08E-06 -3.59E-06 -3.82E-06 -3.70E-06 -3.55E-06 -3.23E-06 -2.03E-06 -2.52E-06 -3.89E-06 -4.25E-06 -3.95E-06 -3.83E-06 -3.42E-06 -3.01E-06 -2.50E-06 -2.12E-06 -2.07E-06 -2.34E-06 -2.97E-06 -3.52E-06 -3.87E-06 -3.85E-06 -3.34E-06 -2.93E-06 -2.83E-06 -2.33E-06 -1.74E-06 -2.00E-06 -2.61E-06 -2.32E-06 -2.05E-06 -2.90E-06 -3.83E-06 -4.08E-06 -3.48E-06 -3.20E-06 -1.89E-06 -7.26E-07 -1.88E-06 -2.48E-06 -2.59E-06 -1.27E-06 -7.86E-07 -3.29E-06 -4.32E-06 -2.73E-06 -2.27E-06 -3.85E-06 -3.93E-06 -1.62E-06 -1.50E-06 -3.07E-06 -1.13E-06 -4.50E-07 -2.52E-06 -1.27E-06 -1.04E-06 -3.51E-06 -1.98E-06 -1.51E-06 4.72E-05 0.000298027 -0.000468594 -0.001470947 -0.001476212 -0.001213067 -0.000780846 -0.000501233 -0.000356343 -0.000248914 -0.000182324 -0.000150969 -0.00013269 -0.000102512 -8.25E-05 -8.26E-05 -6.45E-05 -5.90E-05 -5.18E-05 -3.23E-05 -4.96E-05 -4.07E-05 -1.29E-05 -2.82E-05 -3.70E-05 -1.20E-05 7.40E-06 -5.13E-06 -2.71E-05 -2.28E-05 -4.30E-06 8.62E-06 3.01E-06 -1.38E-05 -1.55E-05 -4.66E-06 7.66E-06 1.62E-05 6.76E-06 -1.25E-05 -1.61E-05 -5.46E-06 6.31E-06 1.36E-05 5.88E-06 -1.10E-05 -1.35E-05 -4.49E-06 5.74E-06 1.42E-05 9.33E-06 -8.89E-06 -1.53E-05 -6.31E-06 4.68E-06 1.37E-05 1.26E-05 -3.62E-06 -1.46E-05 -9.11E-06 1.07E-06 1.06E-05 1.14E-05 -2.25E-06 -1.53E-05 -1.08E-05 1.53E-06 1.19E-05 1.76E-05 4.64E-06 -1.31E-05 -1.33E-05 -3.67E-06 6.79E-06 1.21E-05 8.66E-07 -1.38E-05 -1.23E-05 -1.32E-06 1.00E-05 1.82E-05 1.19E-05 -7.78E-06 -1.51E-05 -7.22E-06 2.52E-06 1.00E-05];
% Q1 = numel(x30);
[Ux30, ix1, ix2] = unique(x30, 'stable');
USlope30 = Slope30(ix1);
Fs = 1/mean(diff(Ux30)); % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
[Lv,m,b] = ischange(USlope30,'linear', 'Threshold',1E-6); % Detect Changes
idx = find(Lv, 1, 'first')-2; % Find Index Of First Chjange (Adjust)
Ux30e = Ux30(idx:end)-Ux30(idx); % Edited Independent Variable Vector
USlope30e = USlope30(idx:end); % Edited Dependent Variable Vector
% figure % Test Plot
% plot(Ux30, [m; b; USlope30], '.-')
% ylim([-1 1]*1E-5)
ixs = find(diff(sign(USlope30e))); % Zero Crossing Indices
per = mean(diff(Ux30e(ixs(end-20:end)))); % Period (Units Of Independent Variable)
Freq = 1/per; % Oscillation Frequency
objfcn = @(b,x) b(1) .* b(2).*x.* exp(b(3).*x) .* exp(b(4).*x) .* sin(2*pi.*b(5) + 2*pi.*b(6)) + b(7);
B0 = [min(USlope30e)*[1;1]; -0.001; -0.0005; Freq; 1E-4; 1E-6];
% objfcn = @(b,x) b(1) .* b(2).*x .* exp(b(3).*x) .* sin(2*pi.*b(4) + 2*pi.*b(5)) + b(6);
% B0 = [min(USlope30e)*[1;1]; -0.001; Freq*1.5; 1E-4; 1E-6];
[B,fv] = fminsearch(@(b) norm(USlope30e - objfcn(b,Ux30e)), B0)
B = 7×1
-0.0201 0.0387 -0.0073 0.0029 0.0031 0.0000 -0.0000
fv = 6.9397e-04
figure
plot(Ux30e, USlope30e, '.')
hold on
plot(Ux30e, objfcn(B,Ux30e), '-r')
hold off
grid
These two models provide the best approximations to the data. (I experimented with others as well.)
The ‘B0’ vector is a vector of the initial parameter estimates.
.
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Curve Fitting Toolbox in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!