How can I custom cylinder rotate axis?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/728614/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/728619/image.jpeg)
1 Kommentar
Akzeptierte Antwort
Matt J
am 3 Sep. 2021
Bearbeitet: Matt J
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!