写了一个m文件来解微分方程,弄了两天了,还是不行,求助。
Show older comments
内容如下: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);
求助啊,因为这个忙了两天了,唉,无奈,新手,谢谢了先。
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Report Generator 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!