error using ode45 from dynamic simulation
Show older comments
Hi, I am trying to use ODE45. Could you please tell me what I am doing wrong. Thanks
t0 = 0; %Initial Simulation Time
tf = 10; %Final Simulation Time
x10 = 0; %Initial condition
[t,x]=ode45('f_nonlinear',[t0,tf],[x10]);
%Plot the data.
hold on
plot(t,x(:,1))
and the other file is here:
function xout = f_nonlinear(t,x)
J =1;
R = 1;
k = 1;
m=1;
b=1;
g=9.8;
L=1;
v=1;
xout(1) = x(2);
xout(2) = k*x(3)/J -m*g*l*sin(x(1))/J -b*x(2)/J;
xout(3)= (-R*x(3)-k*x(2))/L +v/L;
xout = xout';
1 Comment
Azzi Abdelmalek
on 18 Feb 2013
Post the error message
Answers (1)
Azzi Abdelmalek
on 18 Feb 2013
Edited: Azzi Abdelmalek
on 18 Feb 2013
1 vote
What is l in: xout(2) = k*x(3)/J -m*g* l *sin(x(1))/J -b*x(2)/J;
1 Comment
Cyrus Mahin
on 18 Feb 2013
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!