Reputation: 185
I am plotting multiple graphs in the same figure using polar
in MATLAB.
It works fine but I cannot manage to autoadjust the limits of the graph and I ended up with something like this:
Here is a part of my code:
alpha = 0
tmp = [];
matriz = [];
for rad =-pi:0.01:pi
matriz = [matriz; rad, ganhoComb(alpha,0.2,rad)];
end
tmp = matriz;
teta = tmp(:,1);
ro = tmp(:,2);
graf1 = polar(teta,ro);
grid
set(graf1,'color','black','linewidth',1.4)
hold on ;
title(['\fontsize{14}','Método Lax-Wendroff '])
%%
tmp =[]
matriz = []
for rad =-pi:0.01:pi
matriz = [matriz; rad, ganhoComb(alpha,0.4,rad)];
end
tmp = matriz;
teta = tmp(:,1);
ro = tmp(:,2);
graf2 = polar(teta,ro);
set(graf2,'color','green','linewidth',1.4)
Upvotes: 1
Views: 134
Reputation: 11208
First of all your code is not verifiable, becouse of ganhoComb
. What is it?
Your problem - is that using your hold on
you fix the plot, so all other graphs will not scale it:
theta = linspace(0,2*pi,100);
r = sin(2*theta) .* cos(2*theta);
r_max = 1;
h_first = polar(theta,r_max*ones(size(theta)));
hold on;
h = polar(theta, r);
h = polar(theta, r*2);
h = polar(theta, r*3);
So I suggest two solutions:
Create one circle of big size to de sure all your plots will set INTO it. And make it invisible:
set(h_first, 'Visible', 'Off');
it will works but you it will not be a really autoscale.
Hope, it helps!
Upvotes: 1