not enough input arguments error

조회 수: 1 (최근 30일)
sudheer yadav
sudheer yadav 2021년 3월 23일
댓글: Walter Roberson 2021년 3월 23일
function T = trans( a, d,alpha, theta)
%Describing the Denavit-Hartenberg parameters
T =[cosd(theta) -(sind(theta)) 0 a;
sind(theta)*cosd(alpha) cosd(theta)*cosd(alpha) -sind(alpha) -d*sind(alpha);
sind(theta)*sind(alpha) sind(alpha)*cosd(theta) cosd(alpha) d*cosd(alpha);
0 0 0 1 ];
end
at line 3 im getting not enough input arguments

답변 (1개)

Geoff Hayes
Geoff Hayes 2021년 3월 23일
sudheer - if you are calling this function from the command line (or another piece of code) as simply
trans
then you will get this error. The function signature
function T = trans( a, d,alpha, theta)
is telling you that you need to provide four input paramters: a, d, alpha and theta. And so the function should be called like
trans(1,0.5,45,-74)
The above inputs are for example only...I don't know what the units for the inputs should be.
  댓글 수: 5
sudheer yadav
sudheer yadav 2021년 3월 23일
function T = trans( a, d,alpha, theta)
T =[cosd(theta) -(sind(theta)) 0 a;
sind(theta)*cosd(alpha) cosd(theta)*cosd(alpha) -sind(alpha) -d*sind(alpha);
sind(theta)*sind(alpha) sind(alpha)*cosd(theta) cosd(alpha) d*cosd(alpha);
0 0 0 1 ];
end
the above one is the function im calling
the error message in command line is
Not enough input arguments.
Error in Romat (line 2)
T =[cosd(theta) -(sind(theta)) 0 a;
Walter Roberson
Walter Roberson 2021년 3월 23일
I do not observe any error when used in the manor that Geoff suggested.
trans(1,0.5,45,-74)
ans = 4×4
0.2756 0.9613 0 1.0000 -0.6797 0.1949 -0.7071 -0.3536 -0.6797 0.1949 0.7071 0.3536 0 0 0 1.0000
function T = trans( a, d,alpha, theta)
T =[cosd(theta) -(sind(theta)) 0 a;
sind(theta)*cosd(alpha) cosd(theta)*cosd(alpha) -sind(alpha) -d*sind(alpha);
sind(theta)*sind(alpha) sind(alpha)*cosd(theta) cosd(alpha) d*cosd(alpha);
0 0 0 1 ];
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by