Vectors of different length when using plot3.
古いコメントを表示
Basically I want to do a 3D plot of 100 circles with different radii and on a new height plane(h) for each circle. The radius increase for each circle(constant increase) and h increase constantly.
I've never used plot3 before so this code is from the top of my head. I was thinking of using a for loop for both r and h as suggested below. But where should I begin the loop for h? In the beginning(just under r) or as below? And what does it mean that "vectors must be of same length". Which vector?
if true
% for r=1:1:100
t=linspace(0,2*pi);
x=r*cos(t);
y=r*sin(t);
for h=100:100:10000
z=h;
plot3(x,y,z)
end
end
採用された回答
その他の回答 (2 件)
dpb
2013 年 9 月 25 日
Why not try it and see if it's the effect desired?
From
doc plot3
...
plot3(x,y,z), where x, y and z are three vectors of the same length, ...
Roger Stafford
2013 年 9 月 26 日
Change the line
plot3(x,y,z)
to
plot3(x,y,repmat(z,1,size(t,2)))
hold on
カテゴリ
ヘルプ センター および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!