[討論]請問時間對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