ODE45 to solve multiple degree of system free vibration
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I am trying to slove free vibration for four degree system using ode45 and function. However I am not sure why but the response of the system is a streight line. My system has four masses and four spring coefficients, with initial condtions for dispalcemnt for m1= 0.01, for m2= 0.01, for m3= 0.02, for m4= 0.01 and inital velocity 0 0 0 0 for each mass.
I am pasisng my code her. I would apprciate the feedback!
Function
function xdot = f_4degree(t,x)
global M K
A=[zeros(4,4) eye(4,4);-M\K zeros(4,4)]*x;
xdot = A.*x;
ODE45
global M K
m1=10; m2=10; m3=10; m4=10;
k1=50; k2=50; k3=50; k4=50;
M=[m1 0 0 0;0 m2 0 0;0 0 m3 0;0 0 0 m4];
K=[k1+k2 -k2 0 0;-k2 k2+k3 -k3 0;0 -k3 k3+k4 -k4;0 0 -k4 k4];
%ODE45
tspan=[0 20];
IC=[0.01 0.01 0.02 0.01 0 0 0 0];
[t,x]= ode45('f_4degree',tspan,IC);
figure(1)
plot(t,x(:,1));
legend('Repsonse')
ylabel('x(t)')
xlabel('time')
1 Commento
Rik
il 10 Mag 2023
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.
Risposta accettata
Torsten
il 4 Mag 2023
Maybe you mean
m1=10; m2=10; m3=10; m4=10;
k1=50; k2=50; k3=50; k4=50;
M=[m1 0 0 0;0 m2 0 0;0 0 m3 0;0 0 0 m4];
K=[k1+k2 -k2 0 0;-k2 k2+k3 -k3 0;0 -k3 k3+k4 -k4;0 0 -k4 k4];
result = -M\K;
%ODE45
tspan=[0 20];
IC=[0.01 0.01 0.02 0.01 0 0 0 0];
[t,x]= ode45(@(t,x)f_4degree(t,x,result),tspan,IC);
figure(1)
plot(t,x(:,1));
legend('Repsonse')
ylabel('x(t)')
xlabel('time')
function xdot = f_4degree(t,x,result)
A=[zeros(4,4), eye(4,4);result, zeros(4,4)];
xdot = A*x;
end
3 Commenti
Torsten
il 6 Mag 2023
I don't have experience with the physical background of your problem. Can you describe mathematically what the output for the "response of each mass" would be ?
Più risposte (1)
Sam Chak
il 6 Mag 2023
ode45 solves the problem by integrating where . So I guess you looking for states .
m1=10; m2=10; m3=10; m4=10;
k1=50; k2=50; k3=50; k4=50;
M = [m1 0 0 0;
0 m2 0 0;
0 0 m3 0;
0 0 0 m4];
K = [k1+k2 -k2 0 0;-k2 k2+k3 -k3 0;0 -k3 k3+k4 -k4;0 0 -k4 k4];
result = -M\K;
%ODE45
tspan=[0 20];
IC=[0.01 0.01 0.02 0.01 0 0 0 0];
[t,x]= ode45(@(t,x)f_4degree(t,x,result),tspan,IC);
figure(1)
subplot(221)
plot(t, x(:,1)), title('Response of m_{1}'), xlabel('t')
subplot(222)
plot(t, x(:,2)), title('Response of m_{2}'), xlabel('t')
subplot(223)
plot(t, x(:,3)), title('Response of m_{3}'), xlabel('t')
subplot(224)
plot(t, x(:,4)), title('Response of m_{4}'), xlabel('t')
% legend('Repsonse')
% ylabel('x(t)')
% xlabel('time')
function xdot = f_4degree(t,x,result)
A=[zeros(4,4), eye(4,4); result, zeros(4,4)];
xdot = A*x;
end
0 Commenti
Vedere anche
Categorie
Scopri di più su Ordinary Differential Equations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!