Not enough input Arguments
古いコメントを表示
Unfortunately, in line four it tells me that I am not passing enough input arguments. I don't quite understand how to fix the error? The code seems to be correct for me. I actually converted the code from python to matlab because in matlab I need the function.
Thanks for your help!
Code:
function e = angle_axis(T,Td)
e = [];
e(1:3) = Td(1:3,end)-T(1:3,end); % -> Mistake
R = Td(1:3, 1:3) * T(1:3, 1:3).';
li = [R(2, 1) - R(1, 2), R(0, 2) - R(2, 0), R(1, 0) - R(0, 1)];
if any(li)
% diagonal matrix case
if trace(R) > 0
% (1,1,1) case
a = zeros(3,0);
else
a = pi/2*(diag(R)+1);
end
else
ln = norm(li);
a = atan2(ln, trace(R)-1)*li/ln;
end
e(3:1) = a;
end
4 件のコメント
Torsten
2021 年 12 月 29 日
In MATLAB, array indexing starts with 1, i.e. R(0,y) and R(x,0) errors.
Christian Vogel
2021 年 12 月 29 日
Christian Vogel
2021 年 12 月 29 日
採用された回答
その他の回答 (1 件)
Christian Vogel
2021 年 12 月 29 日
3 件のコメント
Torsten
2021 年 12 月 29 日
Where is the call to "angle_axis" ?
You can not just run the function - it expects matrices T and Td. If you don't supply them, it has "not enough input arguments".
Christian Vogel
2021 年 12 月 29 日
In the last line of angle_axis, use
e(1:3) = a
instead of
e(3:1) = a
or whatever is senseful in this context (e(3:1) is empty).
カテゴリ
ヘルプ センター および File Exchange で Call Python from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!