Not enough Input Arguments
Ältere Kommentare anzeigen
Can anyone help with this line 6 error
function dy = cartpend(y,m,M,L,g,d,u)
% dy = time derivative given y=state, m=mass of pendular arm, M = mass of
%cart,l=length of pendulum, g = gravity,d= damping term
%Right hand side function for inverted pendulum on cart
Sy = sin(y(3)); (Says error on this part; not enough input arguments)
Cy = cos(y(3));
D = m*L*L*(M+m*(1-Cy^2));
dy(1,1) = y(2);
dy(2,1) = (1/D)*(-m^2*L^2*g*Cy*Sy + m*L^2*(m*L*y(4)^2*Sy - d*y(2))) + m*L*L*(1/D)*u;
dy(3,1) = y(4);
dy(4,1) = (1/D)*((m+M)*m*g*L*Sy - m*L*Cy*(m*L*y(4)^2*Sy - d*y(2))) - m*L*Cy*(1/D)*u;
end
Antworten (1)
KSSV
am 8 Dez. 2020
Did you enter all your input variables? Don't run the function files using run button or F5 key. You need to define the input variables and then call the function.
y = define your variables ;
m = define your variables ;
M = define your variable ;
L = define your variables ;
g = define your variable ;
d = define your variables ;
u = define your variables ;
dy = cartpend(y,m,M,L,g,d,u) ;
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!