Adding legend to multiple figures
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to have 2 figures with legends. The legend only prints to figure(2), and no legend shows up on figure(1). Cannot find information for this issue.
%Magnitude Plot
figure(1)
opts = bodeoptions;
opts.FreqUnits = 'Hz';
opts.Xlim = [100,100000]; % x-axis limits
opts.Ylim = [-100,100]; % y-axis limits
opts.PhaseVisible = 'off'; % Turn off phase plot
bodeplot(Gp,opts); % Bode plot of Gp
hold on
T = Gc*Gp; % Loop Transfer Function (T)
bodeplot(T,opts); % Bode plot of Gc*Gp
title('Magnitude Plot of Plant & Loop Transfer Function');
legend('Plant','Loop Transfer Function')
%Phase Plot
figure(2)
opts = bodeoptions;
opts.FreqUnits = 'Hz';
opts.Xlim = [100,100000]; % x-axis limits
opts.Ylim = [-360,360]; % y-axis limits
opts.MagVisible = 'off'; % Turn off magnitude plot
bodeplot(Gp,opts); % Bode plot of Gp
hold on
T = Gc*Gp; % Loop Transfer Function (T)
bodeplot(T,opts); % Bode plot of Gc*Gp
title('Phase Plot of Plant & Loop Transfer Function');
legend('Plant','Loop Transfer Function')
0 comentarios
Respuestas (1)
Star Strider
el 25 de Mzo. de 2017
The Control System Toolbox bode and bodeplot functions don’t work like other plots.
When I want to create special plots of transfer functions, I ask for 3 outputs from the bode function, then plot the data as regular subplot plots. I can do anything I with them that I would do with any other plot then. They don’t look any different from the plots that bode or bodeplot produce, so you don’t lose anything.
0 comentarios
Ver también
Categorías
Más información sobre Legend en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!