Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw a 3D arrow/vector in MATLAB? [closed]

Tags:

plot

matlab

I would like to add some arrows to a 3D surface plot to indicate important directions, similar to this one (from povray)

Different colors would be great and a threedimensional letter like the X in the image even more.

like image 951
Tobias Kienzler Avatar asked Jan 13 '12 10:01

Tobias Kienzler


2 Answers

The function 3D arrow plot at the MATLAB file exchange actually does this:

Meanwhile https://ww2.mathworks.cn/matlabcentral/fileexchange/14056-arrow3 turned up, which might be even better but I haven't tested it...

like image 164
Tobias Kienzler Avatar answered Oct 16 '22 07:10

Tobias Kienzler


I used something similar to your approach thta could be a start for you: here is an example of the code:

q=[0 1 0 1]; q=qnorm(q); x = q(1) / sqrt(1-q(4)*q(4))

x =

 0

y = q(2) / sqrt(1-q(4)*q(4))

y =

1.0000

z = q(3) / sqrt(1-q(4)*q(4))

z =

 0

quiver3(0, 0, 0, x, y, z)

It is a quaternion that I normalize and convert to axis components in order to draw it 3D. I also would like to be able to draw it 3D like the picture you posted.

like image 35
Jav_Rock Avatar answered Oct 16 '22 06:10

Jav_Rock