Solving a system of Second Order Equations

5 views (last 30 days)
Eshwar D
Eshwar D on 24 Apr 2022
Commented: Eshwar D on 24 Apr 2022
Trying to solve but not able to get an output
Need the equations of x1 to x5.
m1 = 0.17; m2 = 0.17; m3 = 0.114; m4 = 0.114; m5=0.114;
k = 50; k1 = k; k2 = 0.8*k; k3 = 0.7*k; k4 = 0.6*k; k5=0.6*k; k6=0.9*k;
M = [m1 0 0 0 0; 0 m2 0 0 0; 0 0 m3 0 0; 0 0 0 m4 0; 0 0 0 0 m5];
K = [k1+k2 -k2 0 0 0; -k2 k2+k3 -k3 0 0; 0 -k3 k3+k4 -k4 0; 0 0 -k4 k4+k5 -k5; 0 0 0 -k5 k5+k6];
w = 2*pi*40;
syms x1(t) x2(t) x3(t) x4(t) x5(t)
eqn1 = m1*diff(x1,t,2) + (k1+k2)*x1 - k2*x2 == 5*sin(w*t);
eqn2 = m2*diff(x2,t,2) - k2*x1 + (k2+k3)*x2 - k3*x3 == 5*sin(w*t);
eqn3 = m3*diff(x3,t,2) - k3*x2 + (k3+k4)*x3 - k4*x4 == 5*sin(w*t);
eqn4 = m4*diff(x4,t,2) - k4*x3 + (k4+k5)*x4 - k5*x5 == 5*sin(w*t);
eqn5 = m5*diff(x5,t,2) - k5*x4 + (k5+k6)*x5 == 5*sin(w*t);
eqns = [eqn1; eqn2; eqn3; eqn4; eqn5];
S = dsolve(eqns)

Answers (1)

Alan Stevens
Alan Stevens on 24 Apr 2022
Not sure there is a symbolic solution, but it's easy enough to get a numerical one:
tspan = [0 1]; % Start and end times
% Initial conditions
% x0 = [x1(0), x2(0), x3(0), x4(0), x5(0), v1(0), v2(0), v3(0), v4(0), v5(0)]
x0 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0];
[t, x] = ode45(@rates, tspan, x0);
plot(t,x(:,1:5)), grid
xlabel('t'), ylabel('x')
legend('x1','x2','x3','x4','x5')
function dxdt = rates(t, x)
m1 = 0.17; m2 = 0.17; m3 = 0.114; m4 = 0.114; m5=0.114;
k = 50; k1 = k; k2 = 0.8*k; k3 = 0.7*k; k4 = 0.6*k; k5=0.6*k; k6=0.9*k;
w = 2*pi*40;
x1 = x(1); x2 = x(2); x3 = x(3); x4 = x(4); x5 = x(5);
v1 = x(6); v2 = x(7); v3 = x(8); v4 = x(9); v5 = x(10);
f = 5*sin(w*t);
dxdt = [v1; v2; v3; v4; v5;
(f - ((k1+k2)*x1 - k2*x2))/m1;
(f - (- k2*x1 + (k2+k3)*x2 - k3*x3))/m2;
(f - (- k3*x2 + (k3+k4)*x3 - k4*x4))/m3;
(f - (- k4*x3 + (k4+k5)*x4 - k5*x5))/m4;
(f - (- k5*x4 + (k5+k6)*x5))/m5];
end
  3 Comments
Sam Chak
Sam Chak on 24 Apr 2022
I didn't attempt to solve this problem because I'm unsure if the same force, really acts on each mass point in the Mass–Spring System. Hope @Eshwar D can clarify on this matter sooner.
Eshwar D
Eshwar D on 24 Apr 2022
@Sam Chak, the value if 5sin(wt) isn't acting on each m. As the data is not available for each mass yet, it was just assumed to be that for the moment. The actual values will be different.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!