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 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!