[讨论]请问时间对y作图

楼主: nung1109 (nung)   2017-01-07 14:38:44
版上的各位:
我目前是在octave操作,但似乎没有octave的版,所以在这里询问,谢谢。
我想要当时间到10~15时,H为1,其他时候H为0,但画不出来不知道是哪里有问题,还请大家帮帮忙,谢谢。
_____function file__
function dydt=ps3_1_3_hill_fun(t,y)
H=0;
for 10<t<15
H=1;
end
dydt=1900*H+100-2*y;
end
_____main file_
clear off;
[t,y]=ode45(@ps3_1_3_hill_fun,[0,25],0);
plot(t,y)
______________
另外想请问function档为何都要另存呢?跟写画图的档案一起不行吗?谢谢
作者: tomichy (tomichy)   2017-01-09 22:34:00
for 10<t<15 <=== 这..电脑看不懂吧
作者: sppmg (sppmg)   2017-01-09 23:01:00
function档可以内含多个子函数,把原main改成函数吧然后上面是 for I=[10:15]

Links booklink

Contact Us: admin [ a t ] ucptt.com