contour plot in polar coordinates

조회 수: 12 (최근 30일)
Shani Gal
Shani Gal 2012년 3월 29일
댓글: xiujuan wang 2017년 6월 7일
Hi
Found this code for generating contour plots with polar coordinates. It works, but I don't understand why and I also need to plot contour plots with polar coordinates. Can someone, please, explain the code to me?
Thanks
Shani
++++++++++THE CODE-----------------
% Create polar data
[r,t] = meshgrid(0:.1:5,0:pi/30:(2*pi));
z = r - t;
% Convert to Cartesian
x = r.*cos(t);
y = r.*sin(t);
h = polar(x,y);
hold on;
contourf(x,y,z);
% Hide the POLAR function data and leave annotations
set(h,'Visible','off')
% Turn off axes and set square aspect ratio
axis off
axis image
  댓글 수: 2
Honglei Chen
Honglei Chen 2012년 3월 29일
I think the comments are quite clear
xiujuan wang
xiujuan wang 2017년 6월 7일
Thank you very much.It helps me solve the problem.

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

답변 (1개)

Kye Taylor
Kye Taylor 2012년 3월 29일
It may be helpful to know that the line of code
z = r-t
defines the surface as a function of r and t. For example, if you just wanted to look at the function z(r) = r*cos(t), which is equivalent to the function f(x,y) = x in cartesian coordinates, change
z = r - t;
to
z = r.*cos(t);
  댓글 수: 1
Shani Gal
Shani Gal 2012년 3월 30일
hi
i think z=r-t is part of the input. I have diffrent z for my r and t
what I Don't understand is how the combination of the function polar and contourf results in a conutuor plot in polar coordinates

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

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by