I keep getting an error that says "unrecognized function or variable 'tspan'
이전 댓글 표시
% close by initial condition
Y0 = [0;1.001];
epsilon = 8.53;
F = 1.2;
Tdr = 10;
% ODE solving
[t3,y3] = ode23(@(t,y)VanDerPolEq2(t,y,epsilon,F,Tdr),tspan,Y0);
% plotting
figure();
plot(t2,y2(:,1),'r-','LineWidth',1.0); xlabel('t'); ylabel('x1');
title('x1 vs. t for x1(0) = 0, x2(0) = 1, F = 1.2, Tdr = 10, epsilon = 8.53');
figure();
plot(t3,y3(:,1),'r-','LineWidth',1.0); xlabel('t'); ylabel('x1');
title('x1 vs. t for x1(0) = 0, x2(0) = 1.001, F = 1.2, Tdr = 10, epsilon = 8.53');
figure();
plot(t2,abs(y3(:,1)-y2(:,1)), 'k-', 'LineWidth', 1.0); xlabel('t'); ylabel('absolute difference');
title('absolute difference vs time');
figure();
plot(t2,log(abs(y3(:,1)-y2(:,1))), 'k-', 'LineWidth', 1.0); xlabel('t'); ylabel('log of absolute difference');
title('log of absolute difference vs time');
답변 (1개)
KSSV
2021년 12월 6일
You need to provide the time for which you want to integrate your ode. Call the function something like below:
[t3,y3] = ode23(@(t,y)VanDerPolEq2(t,y,epsilon,F,Tdr),[0 10],Y0);
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!