Rotating Frame in MATLAB
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to simulate the rotating frame using ode45. I am trying to solve the equation
(Inertial frame) d^2R/dt^2 = (rot frame) d^2R/dt^2 + 2WxdR/dt + Wx(WxR)
Where R = [x y z] W = 1 (angular velocity) initial conditions x = 1, y = 0, z = 0 (position)
using ode45 the simulation spirals outward without bound, when it should just simulate a circle (the rotating frame). I guess I need a boundary condition? Here is my function and script
function xdot = Xdot(t, R)
global om
xdot = zeros(6,1);
xdot(1:3,1) = R(4:6,1); %vel
xdot(4:6,1) = -2*cross(om,R(4:6,1))-cross(om,cross(om,R(1:3,1)));
running the script
rpos = [1 0 0]; % position
om = [0, 0, 1]; %(rad/s) angular velocity
rvel = cross(om,rpos);
%numerical integration
[tout,yout] = ode45('Xdot',[0 20],[rpos rvel]);
plot(yout(:,1),yout(:,2), '.')
Please help, I know this is a simple problem.. I'm not sure why I'm having trouble with it.
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Assembly en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!