Not enough input arguments
古いコメントを表示
function xdot = OD(t,x)
global A B C Da K
Aa=A+(B*K*C);
Ba=B*Da;
u=K*x;
xdot=(Aa*x)+(Ba*u);
end
When running this code it show error in the line u=K*x; as not enough inputs. Here A,B,C,Da,K are all 2x2 matrix.
8 件のコメント
Vashist Hegde
2020 年 6 月 30 日
The code looks fine. The error does not seem to be for line:5
Are you sure that while running this function, you are giving t,x as arguments?
Sargondjani
2020 年 6 月 30 日
Look at the workspace when you get the error (with "dbstop if error"). Are K and x defined?
Rik
2020 年 6 月 30 日
Did you run this function with the green button (or with the f5 hotkey)?
Reeshabh Kumar Ranjan
2020 年 6 月 30 日
Did you save the file before running it again?
Stephen23
2020 年 7 月 1 日
Rather than using global variables you should parameterize the function:
Gopika R
2020 年 7 月 1 日
Gopika R
2020 年 7 月 1 日
Walter Roberson
2020 年 7 月 1 日
When you use the green run button, then where are you expecting that MATLAB will look for the values of t and x to use inside the routine?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Surrogate Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!