Rotating Frame in MATLAB
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!