Change marker width in bode plot

By default, the marker width of the bode plot is very large. There is an option to change the line width but no option to change the marker width? How can I change it ?

 Accepted Answer

The bode function doesn’t accept many options with respect to its plots. The easiest way to do what you want is to request at least the first three outputs of the bode function, and then plot them using subplot and plot. The plots are the same as any other plot object:
[mag,phase,wout] = bode(sys);
subplot(2,1,1)
plot(wout, mag)
subplot*2,1,2)
plot(wout, phase)
Use ‘20*log10(mag)’ to plot the magnitude in decibels, and semilogx instead of plot to make the plot look like those bode produces on its own:
[mag,phase,wout] = bode(sys);
subplot(2,1,1)
semilogx(wout, 20*log10(mag))
subplot*2,1,2)
semilogx(wout, phase)

6 Comments

I did this
sys = tf([1],[1 3 2])
[mag,phase,wout] = bode(sys);
subplot(2,1,1)
plot(wout, mag)
subplot(2,1,2)
plot(wout, phase)
It is showing an error as follows
Error using plot
Data cannot have more than 2 dimensions.
Error in Delitaf (line 4)
plot(wout, mag)
Since ‘mag’ and ‘phase’ are 3D arrays, use the squeeze function to remove the singleton dimension in ‘mag’ and ‘phase’ in a SISO system:
[mag,phase,wout] = bode(sys);
magv = squeeze(mag);
phasev = squeeze(phase);
figure(1)
subplot(2,1,1)
semilogx(wout, 20*log10(magv))
ylabel('Magnitude (dB)')
subplot(2,1,2)
semilogx(wout, phasev)
xlabel('Frequency (r/s)')
ylabel('Phase (°)')
I need to have multiple bode plots on a single graph. How and where would I use
hold on
in the above case
I am not certain what you want to do.
One possibility:
figure(1)
subplot(2,1,1)
semilogx(wout1, 20*log10(magv1))
hold on
semilogx(wout2, 20*log10(magv2))
semilogx(wout3, 20*log10(magv3))
hold off
ylabel('Magnitude (dB)')
subplot(2,1,2)
semilogx(wout1, phasev1)
hold on
semilogx(wout2, phasev2)
semilogx(wout3, phasev3)
hold off
xlabel('Frequency (r/s)')
ylabel('Phase (°)')
Thanks a lot. I wanted to do this only.
As always, my pleasure.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!