Legends using bodeplot with latex interpretation
Hi, I am trying to write code for plotting frequency responses and cannot get the legend to accept latex formatting. I know there are issues with all of these signal processing tools and stuff like legends, but if I open the figure in a new window and manually adjust the legend in the property editor then it is possible. So there must be a work around. Here is one of the many iterations I have used, in this version the legend appears, but as soon as I add interpreter to the command then I get errors such as seen below:
G1 = G(1,1);
G2 = G(1,2);
G3 = G(2,1);
G4 = G(2,2);
names = {‘$G_{11}$’, ‘$G_{12}$’, ‘$G_{21}$’, ‘$G_{22}$’};
LegendValues = string(names);
bp = bodeplot(G1, G2, G3, G4);
opts = bodeoptions;
opts.Title.String = ”; % Disable title
opts.XLabel.Interpreter = ‘latex’;
opts.XLabel.FontSize = 12;
opts.YLabel.Interpreter = ‘latex’;
opts.YLabel.FontSize = 12;
opts.PhaseVisible = ‘off’; % Hide phase plot
opts.Grid = ‘on’; % Enable grid
setoptions(bp, opts);
legend(LegendValues);
Error if I add interpreter (legend(LegendValues, "Interpreter","latex");):
"Error using legend (line 176). First argument must be text."
I appreciate any input.
MarcusHi, I am trying to write code for plotting frequency responses and cannot get the legend to accept latex formatting. I know there are issues with all of these signal processing tools and stuff like legends, but if I open the figure in a new window and manually adjust the legend in the property editor then it is possible. So there must be a work around. Here is one of the many iterations I have used, in this version the legend appears, but as soon as I add interpreter to the command then I get errors such as seen below:
G1 = G(1,1);
G2 = G(1,2);
G3 = G(2,1);
G4 = G(2,2);
names = {‘$G_{11}$’, ‘$G_{12}$’, ‘$G_{21}$’, ‘$G_{22}$’};
LegendValues = string(names);
bp = bodeplot(G1, G2, G3, G4);
opts = bodeoptions;
opts.Title.String = ”; % Disable title
opts.XLabel.Interpreter = ‘latex’;
opts.XLabel.FontSize = 12;
opts.YLabel.Interpreter = ‘latex’;
opts.YLabel.FontSize = 12;
opts.PhaseVisible = ‘off’; % Hide phase plot
opts.Grid = ‘on’; % Enable grid
setoptions(bp, opts);
legend(LegendValues);
Error if I add interpreter (legend(LegendValues, "Interpreter","latex");):
"Error using legend (line 176). First argument must be text."
I appreciate any input.
Marcus Hi, I am trying to write code for plotting frequency responses and cannot get the legend to accept latex formatting. I know there are issues with all of these signal processing tools and stuff like legends, but if I open the figure in a new window and manually adjust the legend in the property editor then it is possible. So there must be a work around. Here is one of the many iterations I have used, in this version the legend appears, but as soon as I add interpreter to the command then I get errors such as seen below:
G1 = G(1,1);
G2 = G(1,2);
G3 = G(2,1);
G4 = G(2,2);
names = {‘$G_{11}$’, ‘$G_{12}$’, ‘$G_{21}$’, ‘$G_{22}$’};
LegendValues = string(names);
bp = bodeplot(G1, G2, G3, G4);
opts = bodeoptions;
opts.Title.String = ”; % Disable title
opts.XLabel.Interpreter = ‘latex’;
opts.XLabel.FontSize = 12;
opts.YLabel.Interpreter = ‘latex’;
opts.YLabel.FontSize = 12;
opts.PhaseVisible = ‘off’; % Hide phase plot
opts.Grid = ‘on’; % Enable grid
setoptions(bp, opts);
legend(LegendValues);
Error if I add interpreter (legend(LegendValues, "Interpreter","latex");):
"Error using legend (line 176). First argument must be text."
I appreciate any input.
Marcus bodeplot, legend MATLAB Answers — New Questions