How do I create a cylindrical surface mesh with a changing Z coordinate?
Afficher commentaires plus anciens
t = linspace(0,4)
th = t*.25*pi
z = linspace(0,50);
[TH,Z] = meshgrid(th, z)
R = 30-16*sin(th)
[X,Y,Z] = pol2cart(TH,R,Z);
mesh(X,Y,Z);
daspect([1 1 1])

I'm trying to create a visual for a project, where an object's path is graphed on the x-y plane, with a mesh that extends upwards to represent it's velocity on the z-axis. The object's position is described in polar coordinates. I've managed to graph the path and a mesh of a constant height, but nothing seems to work when I try to parameterize Z with respect to t. Does anyone have any ideas?
Réponses (1)
Maybe something like this:
t = linspace(0,4);
th = t*.25*pi;
v = 20+20*(sin(2*t)+1); % speed (i.e., magnitude of velocity)
z = linspace(0,max(v));
[TH,Z] = meshgrid(th, z);
Z(Z > v) = NaN;
R = 30-16*sin(th);
[X,Y] = pol2cart(TH,R);
mesh(X,Y,Z);
daspect([1 1 1])
Catégories
En savoir plus sur Polar Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
