Two dof mechanical system ode45 solution with matlab

%İ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.

2 commentaires

It is not urgent for me. I just wanted to ask if you could help me get the chart I was trying to get. I edited the "urgent" part.

Connectez-vous pour commenter.

Réponses (1)

Erhan Badem
Erhan Badem le 17 Nov 2018

1 vote

Dear Matlab users, I was able to do the work I wanted to do today. My goal was to perform a simple mechanical system vibration analysis in a matlab environment with a simple mass-spring-damper damping. I'll share the right and running matlab codes and a schematic representation of the mechanical system I'm examining below. I can examine this problem if you have the opportunity to develop new data. Good work
IMG_20181117_025927.jpg
17.11.2018 02:13 G:\odev16.11.2018 erhan\odev.m 1 of 1
%İ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 x1dotdot x2dot x2dotdot]' ;
end
17.11.2018 02:13 G:\odev16.11.2018 erhan\cozum3.m 1 of 1
global k1 k2 c1 c2 m1 m2
k1=1200; %N/m
k2=100;
c1=15;
c2=20; %N/(m/s)
m1=300;
m2=5;
[t,q] = ode45 (@odev, [0 3], [2 0 0.05 0]);
plot(t,q(:,1))
xlabel('zaman')
ylabel('x')
hold on
plot(t,q(:,3))graf.jpg

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Produits

Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by