MATLAB: How to fill the area between two curves on a polar plot

plotpolar

My code looks is below. I attached the two curves it generates, with the data that I have. How can I fill the space between the two curves?
t=data(1,:);
a1=data(11,:);
b1=data(12,:);
r_scale=50;
line_width=2;
font_size=12;
marker = 3;
figure(1)
polarplot(t,a1,'-or','MarkerSize',2)
hold on
polarplot(t,b1,'-ok','MarkerSize',2)
hold on

Best Answer

Yes!
Yours are different. Yours are also an easier problem.
I set up everything in polar coordinates in that code, then used the pol2cart function to create Cartesian representations for them, and plotted them in Cartesian space. My code drew the polar coordinates the same way. It did not use polar or polarplot, since they do not offer the necessary options.
Set your data up in polar coordinates, use pol2cart, patch, then plot.
Use the Plot Full Circumference and Plot Radials section in my code your referred to, to plot the polar coordinate grid. Use the text function for the radial and angle labels if you want them. Use the values in the grid plotting part of my earlier code to get the (x,y) values for your text calls.
This code snippet should get you started:
theta = linspace(0, 2*pi, 18); % Create Data (Angles)
Data1 = rand(1, 18)*0.5 + 0.5; % Create Data (First Radius)
Data2 = rand(1, 18)*0.5; % Create Data (Second Radius)
[x1, y1] = pol2cart(theta, Data1); % Convert To Cartesian
[x2, y2] = pol2cart(theta, Data2);
figure(1)
patch([x1 fliplr(x2)], [y1 fliplr(y2)], 'g', 'EdgeColor','g') % Fill Area Between Radius Limits
hold on
plot(x1, y1, '-k')
plot(x2, y2, '-r')
hold off
axis equal
Experiment to get the result you want. Post back if you have problems. I’ll do my best to help.