matlab - To draw polar plot where points in order by column 1? -


data

0   0.867779926444275 15  0.895866066532554 30  0.791816991652543 45  0.729582701499042 60  0.510896493274811 75  0.349659272558701 90  0.255383327300393 105 0.383729598278156 120 0.604795433670792 135 0.731177670225856 150 0.783135047098391 165 0.984715658218028 

code in matlab

polar(data(:,1), data(:,2), 'k-');  

which gives

enter image description here

you see first point (0) connected 2nd point (135). points connected in order 0 15, 15 30, ..., 150 165, , 165 0 possibly.

how can draw polar plot points connected order in column 1?

polar expects first input in radians, not in degrees. so, use

polar(data(:,1)*pi/180, data(:,2), 'k-'); 

with example values, gives

enter image description here

to connect last point first, repeat first point @ end:

polar(data([1:end 1],1)*pi/180, data([1:end 1],2), 'k-'); 

enter image description here


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -