Error coming as Not enough input arguments
Show older comments
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 Comments
Karan Kannoujiya
on 3 Jul 2022
Hi Arjun,
Could you please send how you calling the function and the value of x and t you are passing in function.
Arjun Gupta
on 3 Jul 2022
Answers (1)
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.
Categories
Find more on Historical Contests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!