which -all bodeplot
/MATLAB/toolbox/shared/controllib/engine/@DynamicSystem/bodeplot.m % DynamicSystem method
w = linspace(0,10*pi,128);
bp = bodeplot(sys_p,sys_np,w);
bp.PhaseMatchingEnabled = "on";
names = {'$G_{11}$', '$G_{12}$', '$G_{21}$', '$G_{22}$'};
legend(names(1),names(2),'interpreter','latex');
Warning: Ignoring extra legend entries.
bp = bodeplot(sys_p,sys_np,w);
bp.PhaseMatchingEnabled = "on";
hLg=legend(names(1),names(2));
hLg.Interpreter='latex'
hLg =
Legend ($G\_{11}$, $G\_{12}$) with properties:
String: {'$G\_{11}$' '$G\_{12}$'}
Location: 'northeast'
Orientation: 'vertical'
FontSize: 8.1000
Position: [0.8298 0.8284 0.1487 0.0857]
Units: 'normalized'
Use GET to show all properties
It appears that legend with the bodeplot is neutered/broken...it is interpreting the 'Interpreter' named parameter as an extra legend and errors there. Setting the interpreter property changes the internal state and doesn't error, but doesn't render the subscripts correctly.
A test of an ordinary plot into a plain axes shows the subscripted G labels as expected.
I think it's a bug...
ADDENDUM
Probably the best workaround for now would be to go back to TeX but just use its syntax for underscore. Not quite as pretty, perhaps, but you might find a different font that would approximate...
bp = bodeplot(sys_p,sys_np,w);
bp.PhaseMatchingEnabled = "on";
names=replace(names,'$','')
names =
{'G_{11}'} {'G_{12}'} {'G_{21}'} {'G_{22}'}
hLG=legend(names(1),names(2));
Except TeX is broke, too. it's definitely buggy.