Solve system of ode

3 次查看(过去 30 天)
Jeroen
Jeroen 2014-4-23
回答: Sara 2014-4-24
Hi,
Last week I tried to experiment with the ode45 function. Now I can solve just a simple ode. But now I have a system with 4 degrees of freedom. Those will be y = [x(t) v(t) theta(t) omega(t)] which represent the distance, velocity, angle and angular velocity of a rolling cilinder.
Can you guys please help me solving this ?
I seperated all the ode's in 4 different ones with the following result:
y' - v(t) - (Fcm/m) = 0
y' + (Cx/m)*x(t) - (Cx*r/m)*theta(t) = 0
y' - omega(t) = 0
y' - (Cx*R/Iy)*x(t) + (Cx*R^2/Iy)*theta(t) = 0
These equations are the result of a matrix A (4x4) times a vector y (4x1) equals dy/dt
Can you guys please help me out solving this?
Thanks in advance

回答(1 个)

Sara
Sara 2014-4-24
How to call the solver:
[t,Y] = ode45(@(t,x)sisdif(t,x,Fcm,m,Cx,r,R,Iy),[t0 t1],initialConditions);
where [t0 t1] is the integration interval initialConditions is a 4by1 array with the initial condition
Function (check the signs to be sure I did it right):
function dy = sisdif(t,y,Fcm,m,Cx,r,R,Iy)
x = y(1);
v = y(2);
theta = y(3);
omega = y(4);
dy = zeros(4,1);
dy(1) = v + (Fcm/m)
dy(2) = - (Cx/m)*x + (Cx*r/m)*theta
dy(3) = + omega
dy(4) = + (Cx*R/Iy)*x - (Cx*R^2/Iy)*theta

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by