I have the following system:
f = ln(1/x) + 3 for when 1<x
f = 3 for when 0<=x<=1
What I want to do is effectively plot this 2D system as a surface in cylindrical coordinates, 'spinning' the line round as to create something resembling a flat-topped cone. Unfortunately, my limited knowledge of of both the surf and mesh functions leave me unsure of how to do this. Any help would greatly appreciated. Thanks.

 채택된 답변

Star Strider
Star Strider 2015년 11월 9일

0 개 추천

Is this what you want to do? If not, experiment with it. This should get you started.
f = @(x) 3.*((x >= 0) & (x <= 1)) + (log(1./x) + 3).*(x > 1); % Function
x = linspace(0, 5, 25); % Change upper Limit & Vector Length
[Xc,Yc,Zc] = cylinder(f(x), 25); % Create Cylinder With ‘f’ Describing Radius
figure(1)
surf(Xc, Yc, Zc) % Plot Resulting Cylinder
grid on

댓글 수: 4

Jack Smith
Jack Smith 2015년 11월 9일
Thanks. This is great, but what I'm trying to do is 'spin' this round:
It took me a while to figure out how to invert that. In the end it was straightforward (but then everything is in retrospect):
f = @(x) 3.*((x >= 0) & (x <= 1)) + (log(1./x) + 3).*(x > 1); % Function
finv = @(x) exp(f(x));
x = linspace(0, 20, 25); % Change upper Limit & Vector Length
[Xc,Yc,Zc] = cylinder(finv(x), 25); % Create Cylinder With ‘f’ Describing Radius
figure(1)
surf(Xc, Yc, 3.1*Zc) % Plot Resulting Cylinder
grid on
axis equal
It doesn’t look exactly like your posted plot because I set axis equal so that I could verify it. Your plot would look like a cross-section of mine if you did the same on your plot.
Jack Smith
Jack Smith 2015년 11월 10일
Brilliant. Thanks!
Star Strider
Star Strider 2015년 11월 10일
My pleasure!
That was definitely a challenge!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

질문:

2015년 11월 9일

댓글:

2015년 11월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by