How can I save internal variable to a vector with ode45.

2 views (last 30 days)
function [dx]= system(t,x)
global m I
F= expression;
u=F+alpha*u(t-1);
dx(1)=x(2);
dx(2)=m*x(1)+u/I;
dx(3)=-m*x(1)-u/I;
dx=[dx(1);dx(2);dx(3)]';
end
[time,Xs]=ode45(@system(t,x),[0:0.1: 7],x01)
x01=[0.05 0.05 0 ]'
I want to save u , and use it to have u(t-1)

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!