How to Curvefit amplitude output of a spring-mass-damper system to find coefficients?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jake
am 7 Mär. 2024
Kommentiert: Alex Sha
am 8 Mär. 2024
First of all, I'm not sure if the title gives the right idea, and if this is possible. If that's the case, my apologies in advance.
I have a data set that displays the amplitude of a system that shows decaying motion. (Sample data set attached). I want to identify the quadratic damping applied in the system. So, I want to find a polynomial in the form a + b*(amplitude). I don't want a polynomial of nth order either. How can I do this?

0 Kommentare
Akzeptierte Antwort
Star Strider
am 7 Mär. 2024
Try this —
load('sampleData.mat')
% whos
objfcn = @(b,t) b(1) .* exp(b(2).*t) .* cos(2*pi*b(3)*t + b(4)) + b(5);
Lvlm = islocalmax(y, 'MinProminence',0.5);
Per = mean(diff(x(Lvlm)));
Freq = Per;
ymax = max(y);
B0 = [ymax; -1E-2; Freq; randn(2,1)];
[B,fv] = fminsearch(@(b) norm(y - objfcn(b,x)), B0)
% nnz(Lvlm)
figure
plot(x,y)
hold on
% plot(x(Lvlm), y(Lvlm), 'vr')
plot(x, objfcn(B,x))
hold off
grid
text(25, 12, sprintf('$f(x) = %.3f \\cdot e^{%.3f \\cdot t} \\cdot cos(2 \\cdot \\pi \\cdot %.3f\\ t %+.3f) %+.3f$',B), 'Interpreter','latex', 'FontSize',11)
% xlim([0 50])
.
1 Kommentar
Alex Sha
am 8 Mär. 2024
b(1) .* exp(b(2).*t) .* cos(2*pi*b(3)*t + b(4)) + b(5);
the results below will be little better:
Sum Squared Error (SSE): 3612.83461221834
Root of Mean Square Error (RMSE): 0.299830523951318
Correlation Coef. (R): 0.990716970140293
R-Square: 0.981520114923963
Parameter Best Estimate
--------- -------------
b1 -13.9887747654467
b2 -0.05066160816698
b3 -199.749779715466
b4 -3.01726078981019
b5 0.287608394237128
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression 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!