MATLAB Answers

How to make 3d graph from a 2d graph based on the 360 degree

37 ビュー (過去 30 日間)
SAMET YILDIZ 2016 年 11 月 30 日
コメント済み: SAMET YILDIZ 2016 年 12 月 1 日
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 件のコメント

サインイン to comment.


KSSV 2016 年 12 月 1 日
clc; clear all ;
x = 0:5:50;
y = 100:-10:0;
pts = [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) ;
hold on

  1 件のコメント

SAMET YILDIZ 2016 年 12 月 1 日
Thanks for the answer. I accepted it because your answer provides a solution what was written by me in the first place. However, my intention was to ask the question "rotation around the z-axis". I put it as 3d-graph to title, yet not on the question content. My mistake.
I edited my question. The edits are written with bold face. Thanks again.

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。

Translated by