[英]Matlab function argument issue
嘿,我有一個函數定義為
drift = @(x1,x2,u)[x2,(a*sin(x1) - b*x2 + u)]*.05;
然后我嘗試在三重for循環中調用它(重復
x1 = 1:length(n1),
x2 = 1:長度(n2)
x3 = 1:length(nu)
)
next = [n1(x1), n2(x2)] + drift([n1(x1), n2(x2), nu(k)]);
並且使用myMDP> @(x1,x2,u)[x2,(a * sin(x1)-b * x2 + u)] *。05(第148行)輸入參數不足,出現錯誤。
該錯誤。 為什么?
f([1,2,3]) %function call with a single parameter, which is a 3 element vector
f(1,2,3) %function call with three parameters
f([1,2,3],[1,2,3],[1,2,3]) %function call with three parameters, each a 3 element vector.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.