[問題] step函數for迴圈的一個問題

看板MATLAB作者 (赴美留學的日子...)時間11年前 (2014/01/07 15:49), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
在寫step response程式的時候: den = [1 2 1]; num = [1 1]; sys = tf(num,den) t = 0 : .01 :20 y = step(sys,t); 然後對y對t畫圖,以上這樣寫可以跑出正確結果,但如果是下面: for t = 0 : .01 : 20 y = step(sys,t); end 卻跑出錯誤: Error using DynamicSystem/step (line 96) In time response commands, the final time must be a positive scalar. 實在看不太懂事為什麼會錯呢? 感謝大家解惑!! -- ╭──╮ q ˙ . ╭════╮ ◤◥◤◥ 此路不通 ││ ˙在 一 起 ╰═ ╤ ═╯ ◣ ◢ ﹕. ˙ ‧ ‧ ███ ψsleeeve ███ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 50.135.126.40

01/07 17:58, , 1F
第一個方式t是陣列,第二個方式,t是單一值
01/07 17:58, 1F
文章代碼(AID): #1Iox6Zd_ (MATLAB)
文章代碼(AID): #1Iox6Zd_ (MATLAB)