Plot and calculate Damping ratio
Mostrar comentarios más antiguos
Hi I want to calculate damping ratio by using the log decrement method, but for my understanding we need to select 2 peaks in order to do it. Can matlab do it by itself ?or I have to do it manually. Here is what I got so far.
[v,T,vT]=xlsread('Velocity_Response_of_Pendulum.xlsx')
Time=v(:,1);
Veloc=v(:,2);
xlabel('Time');
ylabel('Velocity');
plot(Time,Veloc);
%pick the first peak (t,v) (0.372,0.02884)
%pick the 2nd peak (1.826, 0.02883)
damp_ratio=
Respuestas (1)
Star Strider
el 23 de Feb. de 2021
1 voto
7 comentarios
Dai Nguyen
el 23 de Feb. de 2021
Star Strider
el 23 de Feb. de 2021
I have no idea what is in your Excel file.
Read it using readmatrix, then follow the instructions relevant to it in the documentation I linked to.
Dai Nguyen
el 23 de Feb. de 2021
Dai Nguyen
el 23 de Feb. de 2021
Star Strider
el 23 de Feb. de 2021
Try this:
T1 = readtable('Velocity_Response_of_Pendulum.xlsx');
[pks,locs] = findpeaks(T1.velocity, 'MinPeakProminence',1E-2);
exp_dk = @(b,x) b(1).*exp(b(2).*x);
B = fminsearch(@(b) norm(T1.velocity(locs) - exp_dk(b,T1.time(locs))), rand(2,1).*[1;-1]);
figure
plot(T1.time, T1.velocity)
hold on
plot(T1.time(locs), T1.velocity(locs), '^r', 'MarkerFaceColor','r')
plot(T1.time, exp_dk(B,T1.time), '-g', 'LineWidth',1.5)
hold off
grid
ylabel('Amplitude')
xlabel('Time')
title(sprintf('$y(t) = %.4f\\cdot e^{%.6f\\cdot t}$',B), 'Interpreter','latex')
producing:

.
Dai Nguyen
el 23 de Feb. de 2021
Star Strider
el 23 de Feb. de 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!