Graphing in Cylindrical Coordinates using MATLAB

54 ビュー (過去 30 日間)
Mark
Mark 2012 年 4 月 29 日
Hello,
I want to reproduce this graph... http://i45.tinypic.com/121xra1.jpg ... using MATLAB.
It's the graph of g(r, theta) = 1 + r^2*sin(theta) over the unit circle.
Does anyone have any advice?
Thanks :)

採用された回答

Geoff
Geoff 2012 年 4 月 30 日
Advice is to make a start and show us what you have done so far.
Here is my primer:
r = 0:0.1:1;
theta = linspace(0, 2*pi, 12);
You need to use meshgrid
doc meshgrid
And surf
doc surf
And a polar co-ordinate conversion
<insert high-school trigonometry>
The colour map is jet.
I think that's plenty to get you started =)
  6 件のコメント
Mark
Mark 2012 年 5 月 3 日
Thanks again for your comments.
I've got it to this:
r=0:0.1:1;
theta=linspace(0, 2*pi, 13);
[r,theta]=meshgrid(r,theta);
x=r.*cos(theta);
y=r.*sin(theta);
z=1+r.^2.*sin(theta);
mesh(x,y,z)
grid on
axis tight
view([300,30])
xlabel('x = r cos(\theta)')
ylabel('y = r sin(\theta)')
zlabel('g(r,\theta)')
title('Question 6(b)')
the only thing I can see that needs changing the the scaling on the axes
Geoff
Geoff 2012 年 5 月 3 日
Really?
I can see:
- Axis tick labels (and number of grid guides) not consistent with example;
- Colour of grid guides not consistent with example;
- Aspect ratio of default figure not consistent with example;
- Anti-aliasing of mesh lines not consistent with example;
- Background colour of figure not consistent with example.
I pointed out some of these things before. Aren't you lucky to stumble across a fussy old bugger like myself to make your life difficult =)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by