error using ode45 from dynamic simulation
显示 更早的评论
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 个)
Azzi Abdelmalek
2013-2-18
编辑:Azzi Abdelmalek
2013-2-18
1 个投票
What is l in: xout(2) = k*x(3)/J -m*g* l *sin(x(1))/J -b*x(2)/J;
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!