简体   繁体   English

在MATLAB中绘制3D区域

[英]Plotting 3D regions in MATLAB

I am trying to create a 3D region in MATLAB by stacking 2D curves one above the other.I have a particular 2D curve at every height location for a total height h,and I am required to place the 2D curves one above the other to get the 3D region for the height h.How can this be done? 我正在尝试在MATLAB中通过在另一高度上堆叠2D曲线来创建3D区域。我在每个高度位置都有一条特定的2D曲线,总高度为h,我需要将2D曲线一个在另一个之上放置以得到高度为3D的3D区域该怎么做?

For eg,If my curves are circles of uniformly increasing radii through a height interval [1,10] then I should be able to get a frustum of a cone of height 9. 例如,如果我的曲线是通过高度间隔[1,10]均匀增加半径的圆,那么我应该能够得到一个锥度为9的视锥。

Thanks a lot for your help. 非常感谢你的帮助。

Something like this: 像这样:

plot3(x1, y1, repmat(z1,size(x1))),hold on    
plot3(x2, y2, repmat(z2,size(x2))),hold on
plot3(x3, y3, repmat(z3,size(x3))), hold on
%...

where xi , yi is the curve on the plane at zi . 其中xiyizi平面上的曲线。

If your xi have the same length, you can also write it in a loop. 如果您的xi具有相同的长度,则也可以循环编写。

假设您将单元格数组curves作为Nx2数组保存:

cellfun(@(x) plot(x(:,1),x(:,2)),curves);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM