Search code examples
matlabplotpolar-coordinates

Setting a negative value for the center of a polar plot MATLAB


Using MATLAB I would like to plot antenna radiation pattern whose maximum value is set to 0. The remaining values are negative and 0 should be at the outermost circle in a polar plot. If I use regular polar() function negative values are put on the opposite side of where it should be. Thus, the polar plot looks like it is flipped. I don't want that. I want maximum value, which is 0 to be at the outermost circle, whereas the remaining negative values are towards the center, not at the opposite side. You can see an example plot down below. How can I accomplish drawing such a polar plot? I would appreciate your help.enter image description here


Solution

  • rlim seems to do the trick:

                theta=linspace(0,2*pi,200);
                %% The pattern has negative values
                pattern = 10*log10(abs(1+exp(1j*17*sin(theta))));
                %% Makes the max of the pattern 0
                pattern=pattern-max(pattern);
                %% Plots the figure
                figure
                pax = polaraxes;
                polarplot(theta,pattern)
                %% This is what you want. Add a little bit of extra space after the minimum and maximum value
                rlim([min(pattern)-3 max(pattern)+1])
    

    Resulting plot