Bode Plots: viewing values at a particular point

55 次查看(过去 30 天)
How do I find the intercepts of the axes? and how do I find a value at a particular point? (eg. finding the frequency when magnitude=3db)

回答(1 个)

Star Strider
Star Strider 2017-4-30
The Control System Toolbox bandwidth function will work in some situations, but in others it’s necessary to take a less direct approach to calculate the -3 dB points.
Example
s = tf('s');
sys = s^2/(s^3 - 2*s^2 - 2*s + 5);
[mag, phase, wout] = bode(sys);
mag = squeeze(mag);
phase = squeeze(phase);
mag_max = max(mag);
dB_3 = 10^(-3/20)*mag_max;
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector
zx = zci(mag-dB_3);
for k1 = 1:length(zx)
dB3w(k1) = interp1(mag(zx(k1):zx(k1)+1), wout(zx(k1):zx(k1)+1), dB_3, 'linear','extrap');
dB3p(k1) = interp1(wout(zx(k1):zx(k1)+1), phase(zx(k1):zx(k1)+1), dB3w(k1), 'linear','extrap');
end
figure(1)
subplot(2,1,1)
plot(wout, 20*log10(mag))
hold on
plot(dB3w, 20*log10([1 1]*dB_3), 'pg')
hold off
xlabel('Frequency')
ylabel('Amplitude (dB)')
grid
subplot(2,1,2)
plot(wout, phase)
hold on
plot(dB3w, dB3p, 'pg')
hold off
xlabel('Frequency')
ylabel('Phase')
grid
The ‘dB3w’ array are the frequencies of the -3 dB points, and ‘dB3p’ are the phase values at those frequencies.
I’m not certain what you mean by ‘the intercepts of the axes’. Those would seem to be the beginning and end elements of the vectors, so ‘wout(1)’ and ‘wout(end)’, and so for the others.
  4 个评论
Star Strider
Star Strider 2017-5-1
My pleasure.
If my Answer helped you solve your problem, please Accept it!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Plot Customization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by