How can I custom cylinder rotate axis?
8 views (last 30 days)
Show older comments
Hi
I have a 2D graph and I want make it 3D via cylinder. but cylender rotating it about x-axis.
is there anyway to change this? for example rotate about y-axis


1 Comment
Accepted Answer
Matt J
on 3 Sep 2021
Edited: Matt J
on 4 Sep 2021
Another approach:
[Xq,Zq]=ndgrid(linspace(-3,3,100));
[~,Rq]=cart2pol(Xq,Zq);
func=@(r) sin(r)./r; %The 1D profile
x=linspace(0,3,100);
y=func(4*x);
Yq=interp1(x,y,Rq); %rotated about Y-axis
surf(Xq,Yq,Zq,'EdgeColor','none')
xlabel 'X', ylabel 'Y', zlabel 'Z'
4 Comments
See Also
Categories
Find more on 2-D and 3-D 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!


