Plot a tilted looking polygon

I have the following data that creates 3-d plot
x_min = 200; x_max = 500;
rand_x = x_min + (x_max - x_min )*rand(60,1);
y_min = -500; y_max = 950;
rand_y = y_min + (y_max - y_min )*rand(60,1);
z_min = -50; z_max = 50;
rand_z = (z_max - z_min )*rand(60,1);
plot3(rand_x,rand_y,rand_z,'x')
When I rotate it to look from the 2-d view it looks something like this :
What I want is, using the data(min n max of each axis can be changed) and using the same view i.e 2-d view of 3-d data, I want this to look a little tilted. Can anyone tell me how it can be done?

답변 (1개)

Ced
Ced 2014년 10월 22일

0 개 추천

Hi
You could simply multiply your points with a rotation matrix, e.g.
phi = pi/6;
R = [ cos(phi) sin(phi) 0 ; -sin(phi) cos(phi) 0 ; 0 0 1 ]; % R' turns in other direction
rand_new = R*[ rand_x' ; rand_y'; rand_z' ];
and plot them again. This changes the points (but makes the view look tilted as requested). Alternatively, if you only want to change the viewing angle, but keep the points at the same coordinates, you may need to play around with "view".

카테고리

도움말 센터File Exchange에서 General Applications에 대해 자세히 알아보기

질문:

2014년 10월 22일

답변:

Ced
2014년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by