Solve system of ode
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Sara
on 24 Apr 2014
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
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!