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일
Post the error message
답변 (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!