How to get the value of X-axis at the -3dB

9 views (last 30 days)
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

Accepted Answer

William Rose
William Rose on 30 Jan 2024
@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 Comment
William Rose
William Rose on 30 Jan 2024
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
idxUp = 10
idxDn=find(diff(Hdb>=thresh)==-1) % down-crossing index
idxDn = 29
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)
wUp=0.101, wDn=9.998, passband width=9.897 rad/s
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!