Not enough Input Arguments
이전 댓글 표시
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
답변 (1개)
KSSV
2020년 12월 8일
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) ;
카테고리
도움말 센터 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!