File Exchange

image thumbnail

3D Polar Plot

version (1.09 MB) by J De Freitas
Plots 3D polar data with axes.


Updated 08 Mar 2006

No License

Editor's Note: This file was a File Exchange Pick of the Week

Polar3D plots 3 dimensional data given angular and radial ranges. A choice of plot types and interpolation methods is supported by this function. Useful particularly in producing 3D plots sampled on a uniform spacing over a disc.

Version 1.2 introduces the new ?meshl? plot option that allows the user to plot the data without interpolation or modification to the input Zin, and adds a polar axis with suitable tick marks and labels. The output of this option returns the input unchanged as well as the corresponding x and y coordinates, both being the same size as Zin. The ?contourf? plot option has been replaced by the ?meshl? option in this version.

Polar3D(Zin,theta_min,theta_max,Rho_min,Rho_max,meshscale) produces a mesh plot of the data Zin, between theta_min and theta_max, radii Rho_min and Rho_max, with the size of the mesh squares being determined by meshscale; meshscale takes on any real positive value.

Polar3D(Zin,...,plotspec) plots the data as 'surf', 'surfc', 'contour' etc, as set by plotspec.

Polar3D(Zin,..., interpspec) plots the data as mesh plot with 2D 'linear', 'cubic', etc, interpolation over the input data. No interpolation is carried out if the ?meshl? option is used.

[x,y,z] = Polar3D(Zin,...,'off') disengages the plot function and returns the (x,y,z) plot data.

P = peaks(49);

Version History.

Version 1.1. (June 2005). meshscale updated so that Polar3D could take on both integer and non-integer values greater than 0.
Version 1.2. (Mar 2006) introduced the ?meshl? plot option.

Cite As

J De Freitas (2021). 3D Polar Plot (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (25)

Krupavaram Balam

When I using this it giving an error polar3d undefined variable,what to do now. please anyone help me

wa ka

Where's link of Polar3D function file? Please help me?
I'd like to use this to plot hokuto laser's data.


Is it possible to give R and Rho in vector format, instead of giving in Rmin, Rmax format?


Mustafa I've got the same problem as T.T. thanks a lot for Your help :)


I am getting the below error while trying to run your _demo program

??? Error using ==> polarplot3d at 153
Error parsing varargin list
??? Error using ==> lower
Cell elements must be character arrays.

Can you let me know what needs to be fixed to sucessfully run the program?

Hongxiao Jin

Really great! Your job makes life easier.
while Line 317, 318 should be like this

step = (c-1)/(r-1); %1:r change to 1:c
[X1,Y1] = meshgrid(1:c,1:step:c); %start from 1 not 0

to get correct interpolation result of more angle columns.

Otherwise I get asymmetrical interpolation on both sides of 0/360.


Phenomenal Program. You guys absolutly rock.
@Teemu Teekkari
you can use polar3d to output the x,y,z values. THen use surf to make the plot. In suck you can turn off the grid lines. I think that should do what your trying to do.

Eric T

Cool. How can I set meshscale independently for rho and theta?


now I will try to use this program... I will write here my experience related to it....

supot endoo


Mehmet E Yavuz

Definitely a very helpful tool.

Ping Su

I think it will be very helpful.

Danilo Hollosi

Excellent work! Thanks for that:-)
By the way: if you delete the for-statement in "transposing and setting up the magnitude matrix (line 287) and write
P(:,1:c) = temp(:,c-[1:c]+1); instead,
the computanional speed increeses, especialy for large inputdata.

Gao Yueming

Thank you!

Zygmunt Klusek

My congratulations. Excellent work. Thank You

weijunzhao zhao

it works well

Spencer Chen

All good. Except Matlab somehow cannot handle 'contourf' in this context.

hu st

Good functions with clear instructions..
and an aid for programming methods

Chris Chris

Very good code with nice output. The restrictions on the input format can get cumbersome and hard to understand, but once you get used to them it works very well.

Ravi M R

What I was expecting was the horizontal plane to represent angle (in degree/radians) like "polar" function of matlab

Ernst Eiper

It is a perfect function for plotting any kind of intensity data in cylindrical coordinates. What I am still missing is the feature to set the z axis to logarithmic scale. If it is easy for you .. could you please include this feature in your function

Y han

Afaq Ahmad

Teemu Teekkari

Excellent program, but I'm still missing one function. I'd need a program that plots a continous 2D intensity graph in rainbow colors and polar coordinates. Like pcolor but in polar coordinates. I'd be grateful if you'd include that in the next version.

Elva Robinson

Well documented and easy to use function. It has made my life a lot easier!

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: Fiber modes, 3D Polar Plot, Zernike calculator

Community Treasure Hunt

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

Start Hunting!