Bode plot phase grid alpha

7 次查看(过去 30 天)
Marko
Marko 2016-8-15
Hello,
I'd like to decrease transparency of grid lines in magnitude and phase plot in bode plot. I managed to do it for magnitude plow with command:
ax1 = gca;
ax1.GridAlpha = 0.5;
ax1.MinorGridAlpha = 0.5;
But it doesn't work for phase plot. Is there a way to do it for both? Thanks

回答(1 个)

Star Strider
Star Strider 2016-8-15
The bode and bodeplot functions don’t act like normal subplots, so that may not be possible.
There is a work-around if you have the Signal Processing Toolbox. Use the freqs (or for discrete systems, freqz) function. You cannot use your Control Systems Toolbox ‘system’ objects, so you have to use the transfer function, but that’s a minor inconvenience if the plot format is important.
This works:
b = [0.1 0.2 0.3]; % Create Transfer Function
a = [0.1 0.9 0.2]; % Create Transfer Function
figure(1)
freqs(b,a);
ax1 = subplot(2,1,1);
ax1.GridAlpha = 0.5;
ax1.MinorGridAlpha = 0.5;
ax2 = subplot(2,1,2);
ax2.GridAlpha = 0.5;
ax2.MinorGridAlpha = 0.5;
  2 个评论
Star Strider
Star Strider 2016-8-15
Marko’s ‘Answer’ moved here:
(15:30 UCT)
Thanks for the answer but the option with freqs is a bit clunky for me at the moment. Nevertheless, thanks for the proposition. Finally I changed LineWidth to make the grid a bit more visible when I print out the figures.
Star Strider
Star Strider 2016-8-15
My pleasure.
You would have to get your transfer function from your system object, but that’s relatively easy to do:
b = [0.1 0.2 0.3]; % Create Transfer Function
a = [0.1 0.9 0.2]; % Create Transfer Function
h = tf(b,a);
hb = h.Numerator{:};
ha = h.Denominator{:};
Then plug them into freqs and everything else will work.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Pole and Zero Locations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by