What is the "-20dB" bandwidth of a signal and how to calculate it in MATLAB
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
2NOR_Kh
am 23 Okt. 2022
Kommentiert: William Rose
am 29 Okt. 2022
I searched to find the answer, I could find the 3dB bandwidth which is half power bandwidth and there is function to find that in MATLAB: bw = powerbw(x)
But I dont know anything about -20dB bandwidth, how to calculate it and the applications of using this one over 3dB.
Any helps appreciated,
0 Kommentare
Akzeptierte Antwort
William Rose
am 23 Okt. 2022
@Star Strider has given an excellent answer that explains, with code and figures, how to find the bandwidth of a filter, or transfer function. (I uset those terms interchangeably.)
The bandwidth of a signal is a closely related concept to the bandwidth of a filter or transfer funciton. You compute the power spectrum of a signal. YOU find the peak power in the power spectrum. The -20 dB bandwidth is the range of frequencies, around the frequency of peak power, in which the signal's power is not more than 20 dB less than the peak power.
The explanation and diagrams in powerbw() are good. They mostly show -3 dB bandwidth in the examples, since - 3 dB is the default, but you can use the r argument (r=20) to get the (-)20 dB bandwidth.
6 Kommentare
William Rose
am 28 Okt. 2022
The code below shows why powerbw gives an unsatisfactory answer for some signals. As I said earlier, powerbw() computes the spectrum with periodogram(), a rectangular window, and no segment averaging. This means the spectrum is not smoothed. Therefore powerbw() finds frequencies that are 20dB down, very close to the frequency of max power. Thus the bandwith estimate by powerbw() is very narrow when the spectrum is noisy.
x=importdata('rf_line220_f1.mat'); %read data file
fs=40e6; %sampling rate
dB1=20; %bandwidth limit
%% Compute & plot spectrum with pwelch & winlen=128
figure;
pwelch(x,128,[],[],fs); %plot pwelch spectrum
%% Compute bandwidth with powerbw()
[bw1,flo,fhi]=powerbw(x,fs,[],dB1);
%% Compute spectrum with periodogram
[pxx,f]=periodogram(x,ones(length(x),1),length(x),fs,'power');
pxxdB=10*log10(pxx); %power spectrum in dB
%% Plot power spectrum
%% Add lines at max power, max power-20dB, flo, fhi
figure; subplot(211)
plot(f,pxxdB,'-b.')
xlabel('Frequency (Hz)'); ylabel('Power (dB)'); grid on; hold on
yline(max(pxxdB),'--r'); yline(max(pxxdB)-20,'--r')
xline(flo,'r'); xline(fhi,'r')
%% Plot same spectrum with zoomed in frequency scale
subplot(212)
plot(f,pxxdB,'-b.')
xlabel('Frequency (Hz)'); ylabel('Power (dB)'); grid on; hold on
yline(max(pxxdB),'--r'); yline(max(pxxdB)-20,'--r')
xline(flo,'r'); xline(fhi,'r')
xlim([flo-bw1,fhi+bw1]) %specify narrow frequency range for plot
%% Display bandwith from powerbw() on console
fprintf('powerbw: bandwidth %.2e to %.2e = %.2e Hz.\n',...
flo,fhi,bw1);
Note the difference between the smooth spectrum computed with pwelch (top figure) and a window width of 128 (and, by default, a Hamming window) and the noisy spectrum computed by periodogram with no segment averaging and a rectangular window.
William Rose
am 29 Okt. 2022
Another suggestion for getting reasonable results from powerbw() is to use the spectrum computed the way you want to compute it:
x=importdata('rf_line220_f1.mat'); %read data file
fs=40e6; %sampling rate
dB1=20; %bandwidth limit
N=128; %window width for spectrum computation
[pxx,f]=pwelch(x,N,[],[],fs); %compute power spectrum
[bw1,flo,fhi]=powerbw(pxx,f,[],dB1); %compute bandwidth with powerbw()
pxxdB=pow2db(pxx);
plot(f,pxxdB,'-b.') %plot power spectrum
xlabel('Frequency (Hz)'); ylabel('Power (dB)'); grid on; hold on
yline(max(pxxdB),'--r'); yline(max(pxxdB)-20,'--r')
xline(flo,'--r'); xline(fhi,'--r')
The bandwidth range, when we use powerbw() this way, looks reasonable.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spectral Measurements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!