trplot function not plotting a 4x4 matrix

조회 수: 12 (최근 30일)
Hassan Bosha
Hassan Bosha 2020년 4월 4일
답변: George Abrahams 2023년 12월 14일
i'm trying to plot NewDist
but it gives me this error
Error in trplot (line 365)
set(hg, 'Matrix', T);
Error in Untitled3 (line 9)
trplot(NewDist,'view',[15 15])
B = [ 0 1 0 2 ; 1 0 0 4 ; 0 0 1 -6 ; 0 0 0 1];
d = transpose([5 2 6]);
disp(d)
NewDist = transl(d) * B ;
disp(NewDist)
trplot(NewDist,'view',[15 15])

답변 (2개)

Ameer Hamza
Ameer Hamza 2020년 4월 4일
I guess you are using trplot function from Peter Corke's robotics toolbox. Your rotation matrix
[0 1 0;
1 0 0;
0 0 1];
Chang your matrix B like this
B = [ 0 -1 0 2 ;
1 0 0 4 ;
0 0 1 -6 ;
0 0 0 1];
and it will work fine.
  댓글 수: 7
Hassan Bosha
Hassan Bosha 2020년 4월 5일
how can i draw a point in 3d then ?
Ameer Hamza
Ameer Hamza 2020년 4월 5일
Can you explain what you are trying to do. It seems like you don't need to use trplot at all. You can try a point in 3D using plot3() command
plot3(1,2,3, '+')
will draw a point at x=1, y=2, and z=3.

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


George Abrahams
George Abrahams 2023년 12월 14일
I assume that you want to plot the different coordinate systems, so that you can see the effect of your rotation.
While I'm not familiar with trplot, my plotframe function on File Exchange will do something similar.
You can see a number of examples for that here.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by