Adding legend to multiple figures
Mostra commenti meno recenti
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')
Risposte (1)
Star Strider
il 25 Mar 2017
0 voti
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.
Categorie
Scopri di più su Legend in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!