How to draw an elliptical cylinder from given xyz coordinates
12 views (last 30 days)
Show older comments
Hi everyone,
I have an object that is an elliptical cylinder and I'm trying to draw it in matlab, to run some calculations on the model.
I was wondering how to draw an elliptical cylinder and which xyz coordinates I need to provide for that.
I've tried using mupad, but only managed to create a cylinder so far and not sure if it's even useful for me in any way.
Any ideas?
Thanks in advance, Yotam
Answers (1)
Walter Roberson
on 12 May 2015
Create a planar ellipse of the appropriate shape and coordinates. Splice on a column that are the Z coordinates for each layer.
For example,
[x, y] = pol2cart(linspace(0,2*pi,60).', 1);
x = x * 5 + 50; %axis 5, center 50
y = y * 15 + 75; %axis 15, center 75
z = linspace(20,40,10); %per-slice z coordinates
xy3d = repmat([x,y], 1, 1, length(z));
xyz = cat(3, xy3d, repmat(reshape(z, 1, 1, length(z), length(x), 2, 1));
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!