Bode Plots: viewing values at a particular point
22 ビュー (過去 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)
0 件のコメント
回答 (1 件)
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
2017 年 5 月 1 日
My pleasure.
If my Answer helped you solve your problem, please Accept it!
参考
カテゴリ
Help Center および File Exchange で Plot Customization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!