Error coming as Not enough input arguments
1 回表示 (過去 30 日間)
古いコメントを表示
function dx = invpen(t,x)
M = 3;
m = 0.4;
I = 1.5;
g = 9.8;
b = 1;
U = 0;
dx=zeros(4,1);
dx(1)=x(2);
dx(2)=((-g*m*sin(x(3))*cos(x(3))) + (m*l*(x(4))^2*sin(x(3))) + (m*b*x(4)*cos(x(3))) + U)/(M+(1-(cos(x(3))*cos(x(3))))*m);
dx(3)=x(4);
dx(4)=(((M+m)*((b*x(4))-(g*sin(x(3))))) + (m*l*(x(4))^2^sin(x(3))+cos(x(3)))+ (U*cos(x(3))))/(l*((m*cos(x(3))*cos(x(3)))-M-m));
end
2 件のコメント
Karan Kannoujiya
2022 年 7 月 3 日
Hi Arjun,
Could you please send how you calling the function and the value of x and t you are passing in function.
回答 (1 件)
Raghav
2022 年 7 月 3 日
編集済み: Raghav
2022 年 7 月 3 日
There are a few problems in this function.
First input argument 't' is not used anywhere in the function, so you can remove it from input argument list to remove this warning.
Second, the variable 'l' used in the calculation of dx(2) and dx(4)is not defined, also the variable 'ɪ' you defined is not used anywhere in the function, so I guess in the original formula, there was 'ɪ' instead of 'l' like:
dx(2)=((-g*m*sin(x(3))*cos(x(3))) + (m*I*(x(4))^2*sin(x(3))) + (m*b*x(4)*cos(x(3))) + U)/(M+(1-(cos(x(3))*cos(x(3))))*m);
and
dx(4)=(((M+m)*((b*x(4))-(g*sin(x(3))))) + (m*I*(x(4))^2^sin(x(3))+cos(x(3)))+ (U*cos(x(3))))/(I*((m*cos(x(3))*cos(x(3)))-M-m));
If you still face the error- "Not enough input arguments", call the function "invpen" with proper x, x should be an array of size atleast 4.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!