contour plot in polar coordinates

13 visualizaciones (últimos 30 días)
Shani Gal
Shani Gal el 29 de Mzo. de 2012
Comentada: xiujuan wang el 7 de Jun. de 2017
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 comentarios
Honglei Chen
Honglei Chen el 29 de Mzo. de 2012
I think the comments are quite clear
xiujuan wang
xiujuan wang el 7 de Jun. de 2017
Thank you very much.It helps me solve the problem.

Iniciar sesión para comentar.

Respuestas (1)

Kye Taylor
Kye Taylor el 29 de Mzo. de 2012
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 comentario
Shani Gal
Shani Gal el 30 de Mzo. de 2012
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

Iniciar sesión para comentar.

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by