Bode plot phase grid alpha

조회 수: 17 (최근 30일)
Marko
Marko 2016년 8월 15일
댓글: Star Strider 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