Two dof mechanical system ode45 solution with matlab
Show older comments
%İki serbestlik dereceli mekanik sistem
function dq = odev(t,q)
global k1 k2 c1 c2 m1 m2
x1 = q(1);
x1dot = q(2);
x2 = q(3);
x2dot = q(4);
x1dotdot = (k2*(x2-x1)+c2*(x2dot-x1dot-k1*x1-c1*x1dot))/m1 ;
x2dotdot = (-k2*(x2-x1)-c2*(x2dot-x1dot))/m2 ;
dq = [x1dot x2dot x1dotdot x2dotdot]' ;
end
global k1 k2 c1 c2 m1 m2
k1=10;
k2=17;
c1=0000.2;
c2=0000.5;
m1=9;
m2=2;
[t,q] = ode45 (@odev, [0 10], [5 0 0 0]);
plot(t,q(:,1))
xlabel('zaman')
ylabel('x')
hold on
plot(t,q(:,2))
Friends, I need to solve the problem according to the coding system I wrote above. I can not get the desired graphic for making a mistake in one place.
Answers (1)
Erhan Badem
on 17 Nov 2018
1 vote
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
