How to Curvefit amplitude output of a spring-mass-damper system to find coefficients?

4 ビュー (過去 30 日間)
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?

採用された回答

Star Strider
Star Strider 2024 年 3 月 7 日
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)
B = 5x1
13.4564 -0.0478 -0.2511 0.0046 0.0677
fv = 86.0608
% 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 件のコメント
Alex Sha
Alex Sha 2024 年 3 月 8 日
If taking fitting function as @Star Strider proposed:
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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by