How to make 3d graph from a 2d graph based on the 360 degree
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SAMET YILDIZ
el 30 de Nov. de 2016
Comentada: SAMET YILDIZ
el 1 de Dic. de 2016
Hi all, I want to convert a simple x&y-axis 2D plot rotating around 360 degree around the 3rd dimension, let say z-axis, and form a volume like representation. The example should be like this:
x = 0:5:50; y = 100:-10:0; plot(x,y)
% I want the same graph with different y values within the interval 0:45:360 which would be represented around z-axis. How can I do this ?
0 comentarios
Respuesta aceptada
KSSV
el 1 de Dic. de 2016
clc; clear all ;
x = 0:5:50;
y = 100:-10:0;
pts = [x;y] ;
plot(x,y)
th = pi/180*[0:45:360] ;
for i = 1:length(th)
% rotation matrix
R = [cos(th(i)) sin(th(i)) ; -sin(th(i)) cos(th(i))] ;
ptsr = zeros(size(pts)) ;
for j = 1:length(x)
ptsr(:,j) = R*pts(:,j) ;
end
hold on
plot(ptsr(1,:),ptsr(2,:))
end
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!