写了一个m文件来解微分方程,弄了两天了,还是不行,求助。
이전 댓글 표시
内容如下:function dy = Function(t,x)
dy = zeros(2,1);
dy(1) = x(2);
dy(2) = sign(sin(t))+3*cos(t/2);
[t,x] = ode45(@Function,[0 10],[0 0]);
点击“Run”,提示如下:

而我按它的提示把t,x都输入0,又提示:
Attempted to access x(2); index out of bounds because numel(x)=1.
Error in Function (line 3)
dy(1) = x(2);
求助啊,因为这个忙了两天了,唉,无奈,新手,谢谢了先。
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!