How can I make a cartesian graph into a polar graph?
Show older comments
I have a 16x9 array, of which the last 8 columns are 1x37 matrices (for angles 0:5:180), so the end goal is to get 16 different graphs.
The last 6 columns were calculated by me, in radians. The columns 2 and 3 were read from a file, in degrees, so I convert those to radians and then try to plot them together, against the x value shown.
figure(1)
hold on
for i=0:5:180
x((i/5)+1)=(i*pi)/180;
end
for i=1:length(DataAll)
for j=2:3
DataAll{i,j}=DataAll{i,j}*pi/180;
end
end
for i=2:9
polarplot(x,DataAll{1,i});
end
Hopefully this is enough information to go on, if not I can provide more.
6 Comments
dpb
on 12 Jul 2018
x=deg2rad(0:5:180);
will replace the first loop.
I can't follow the 16x9 with 8 vectors; show us a sample subset.
You say you have data for the 0:5:180 angles but you need an r value to plot against and you seem to think those are angles, too? That doesn't seem to make any sense (unless the measured data are some tracking to a target of a device or something???).
In the end, you really didn't ask a question...does this do what you expect and if not, what did you get and what were you expecting?
Connor Sherod
on 12 Jul 2018
Connor Sherod
on 12 Jul 2018
dpb
on 13 Jul 2018
A polar axes object created by polarplot is unique and can't be mixed with other plot functions.
You could use two overlaying axes a la plotyy trick or you might be able to revert to the old polar which still uses a conventional axes; I've never tried that.
dpb
on 13 Jul 2018
" theta to be the x from above, and the r values are the values within the 1x37"
So the idea is 16 figures with 8 lines on each?
How about attaching a .mat file with the data array for folks to play at...the polarplot is a pretty new beastie...
Connor Sherod
on 13 Jul 2018
Answers (0)
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!