Plotting a multi-function surface?

4 ビュー (過去 30 日間)
Jack Smith
Jack Smith 2015 年 11 月 9 日
コメント済み: Star Strider 2015 年 11 月 10 日
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 日
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 月 10 日
Brilliant. Thanks!
Star Strider
Star Strider 2015 年 11 月 10 日
My pleasure!
That was definitely a challenge!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by