How to get the value of X-axis at the -3dB
조회 수: 8 (최근 30일)
이전 댓글 표시
I have a custom transfer function and i would like to get the -3dB BW with great accuracy.
I tried the find function over the frequency response (with some tolerance) and get the corresponding index,
but the return value isn't exactly -3dB. Is there any way to get freq_resp(index) = -3dB, without increasing the number of
total x-axis samples?
Thanks in advance
댓글 수: 0
채택된 답변
William Rose
2024년 1월 30일
@Chris, There is no guarantee that H(f) will = -3 dB at one of the frequencies at which you evaluate H(f). Therefore, since it seems you don't want to increase the number of samples, you can do linear interpolation to estimate the frequency at which H(f) crosses -3 dB. I will add an example. By the way, since you are trying to be highly accurate, you might want to find the -3.01 dB frequency, since that is the frequency at which the power is attenuated by 50%.
댓글 수: 1
William Rose
2024년 1월 30일
A simple bandpass:
w=logspace(-2,2,39);
s=1i*w;
T1=.1; T2=10;
H=s*T2./((1+s*T1).*(1+s*T2));
Hdb=20*log10(abs(H));
thresh=-3.01;
% plot results so far
semilogx(w,Hdb,'-b.');
hold on; yline(thresh,'--r')
grid on; xlabel('Frequency (rad/s)'); ylabel('|H| (dB)')
Find indices where threshold is crossed:
idxUp=find(diff(Hdb>=thresh)==1) % up-crossing index
idxDn=find(diff(Hdb>=thresh)==-1) % down-crossing index
Find frequencies by linear interpolation
w1=w(idxUp); w2=w(idxUp+1);
h1=Hdb(idxUp); h2=Hdb(idxUp+1);
wUp=w1+(w2-w1)*(thresh-h1)/(h2-h1);
w1=w(idxDn); w2=w(idxDn+1);
h1=Hdb(idxDn); h2=Hdb(idxDn+1);
wDn=w1+(w2-w1)*(thresh-h1)/(h2-h1);
display results on console and on plot
plot(wUp,thresh,'r*',wDn,thresh,'r*');
xline(wUp,'--g'); xline(wDn,'--g');
fprintf('wUp=%.3f, wDn=%.3f, passband width=%.3f rad/s\n',wUp,wDn,wDn-wUp)
It is not perfect, since we're using linear interpolation on a curve that's not linear. If you sample H(w) more frequently than on the plot above, the accuracy will improve.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
