Adding legend to multiple figures
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Star Strider
am 25 Mär. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!