I have written a small script that inputs a text file of my experimental bode plot measurements and then using tf(), I created the theoretical plot. Using semilogx(), I plotted the experimental data. Then using hold on; and bodeplot I plotted the theoretical data on the same graph.
I'm having two issues, the first is that with the current code I have written, I cannot get the legend to read Calculated and Measured. Instead, two legend boxes appear. One with both calculated and measured and the other with only measured. Why is calculated appearing twice? How can I achieve one legend box with both plot labels?
My second problem is with the bodeoptions. It will not accept any XLabel, YLable, or Title input arguments. Why is this happening?
A snippet of my code:
figure(1);opts = bodeoptions('cstprefs');opts.PhaseVisible = 'off';opts.FreqUnits = 'Hz';opts.FreqScale = 'linear';opts.Grid = 'on';semilogx(butterWorthLP(1:3:end), butterWorthLP(2:3:end), 'b','linewidth',2)legend('Measured Butterworth Filter','location','southwest');hold on;h = bodeplot(sys2,opts,'b-.');legend ('Calculated Butterworth Filter','location','southwest');f = findobj(gcf,'type','line');set(f,'linewidth',2);title('Butterworth Filter: Experimental vs. Theoretic');
Best Answer