Bode Plots: viewing values at a particular point
조회 수: 64 (최근 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
참고 항목
카테고리
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!