How to solve Multiple DOF Mass Spring Damper system and find/plot acceleration, velocity & displacement vs time
Afficher commentaires plus anciens
I know to solve 1 DOF system but i dont know to solve multiple DOF (Matrix will come instead of single value);
Also how to find acceleration?


I am getting absurd/wrong values. Kindly correct the code
Function Code :-
% ODE Function
function dxdt = Ransom(t, x, M, K, C)
m1 = 25.81;m2 = 15.36; m3 = 40.35; m4 = 10.12;
c1 = 3564; c2 = 5685; c3 = 8550; c4 = 620;
k1 = 950000; k2 = 262800; k3 = 213000; k4 = 450000;
w = 50; F = 5;
M = [m1 0 0 0; 0 m2 0 0; 0 0 m3 0; 0 0 0 m4];
C = [c1+c2 -c2 0 0; -c2 c2+c3 -c3 0; 0 -c3 c3+c4 -c4; 0 0 -c4 c4];
K = [k1+k2 -k2 0 0; -k2 k2+k3 -k3 0; 0 -k3 k3+k4 -k4; 0 0 -k4 k4];
dxdt = zeros(8, 1) ;
dxdt(1) = x(5) ;
dxdt(2) = x(6) ;
dxdt(3) = x(7) ;
dxdt(4) = x(8) ;
dxdt(5) = 5*sin(w*t) -K(1)/M(1) * x(1) - K(2)/M(1) * x(2) -C(1)/M(1) * x(5) - C(2)/M(1) * x(6) ;
dxdt(6) = -K(5)/M(6) * x(1) - K(6)/M(6) * x(2) - K(7)/M(6) * x(3) -C(5)/M(6) * x(5) - C(6)/M(6) * x(6) - C(7)/M(6) * x(7) ;
dxdt(7) = -K(10)/M(11) * x(1) - K(11)/M(11) * x(2) - K(12)/M(11) * x(3) -C(10)/M(11) * x(5) - C(11)/M(11) * x(6) - C(12)/M(11) * x(7) ;
dxdt(8) = -K(15)/M(16) * x(3) - K(16)/M(16) * x(4) -C(15)/M(16) * x(7) - C(16)/M(16) * x(8) ;
end
Calling Code: -
clear all;clc;
m1 = 25.81;m2 = 15.36; m3 = 40.35; m4 = 10.12;
c1 = 3564; c2 = 5685; c3 = 8550; c4 = 620;
k1 = 950000; k2 = 262800; k3 = 213000; k4 = 450000;
w = 50; F = 5;
M = [m1 0 0 0; 0 m2 0 0; 0 0 m3 0; 0 0 0 m4];
C = [c1+c2 -c2 0 0; -c2 c2+c3 -c3 0; 0 -c3 c3+c4 -c4; 0 0 -c4 c4];
K = [k1+k2 -k2 0 0; -k2 k2+k3 -k3 0; 0 -k3 k3+k4 -k4; 0 0 -k4 k4];
tspan = [0 1000] ;
y0 = [0 0 0 0 0 0 0 0] ;
[t,x]=ode45('Ransom',tspan,y0);
x_ = x(:, 1:4) ;
xdot_ = x(:, 5:8) ;
subplot(2,1,1)
plot(t, x_);
subplot(2,1,2)
plot(t, xdot_);
Réponse acceptée
Plus de réponses (1)
Stephan
le 24 Jan 2021
tspan=[0 10]; % Simulation time
z0=[0;0]; % Initial conditions for forced vibration
[t,z]=ode45(@forced_vibration,tspan,z0);
subplot(2,1,1)
plot(t,z(:,1),'color','b','LineWidth',2);
grid on
xlabel('Time (t) (sec)')
ylabel('Displacement (x) (m)')
title('Displacement Vs Time (Forced Vibration)')
subplot(2,1,2)
plot(t,z(:,2),'color','b','LineWidth',2);
grid on
xlabel('Time (t) (sec)')
ylabel('Velocity (xdot) (m/s)')
title('Velocity Vs Time (Forced Vibration)')
function f = forced_vibration(t,z)
m = 10; % Mass(kg)
c = 10; % Damping coefficient (Ns/m)
k = 1000; % Stiffness coefficient (N/m)
F = 1; % Force (N)
w = 50; % Excitation frequency(rad/s)
f = [z(2);((F/m)*sin(w*t)-(c/m)*z(2)-(k/m)*z(1))];
end
2 commentaires
AJMIT KUMAR
le 24 Jan 2021
Modifié(e) : AJMIT KUMAR
le 24 Jan 2021
AJMIT KUMAR
le 24 Jan 2021
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!