Calculate the stop band energy of a filter by its Power spectral density graph

4 ビュー (過去 30 日間)
Sara Nasir
Sara Nasir 2020 年 12 月 26 日
コメント済み: Sara Nasir 2021 年 2 月 23 日
I want to find the stop band energy of a filter by its Power spectral density graph. Stop band energy is calculated with normalized total energy.
I can not find the command for it. Below is the correct code of a rectangular filter.
%% Rectangular Filter
Ts = 0.01; % sampling time
time = -20:0.01:20; % time axis
NFFT = 2048; % number of samples
freq = linspace(-0.5,0.5,NFFT); % frequency axis
ht_Rectangular = zeros(size(time));
%% In Time Domain
for n = 1:length(time)
if time(n)>=-0.5 && time(n)<=0.5
ht_Rectangular(n) = 1;
end
end
figure(1);
plot(time,ht_Rectangular);
xlabel('t/T_s');
ylabel('h(t)');
title('Impulse Response of Rectangular Filter');
grid on,
%% In Frequency Domain
Hf_Rectangular = fftshift(fft(ht_Rectangular,NFFT)); % FFT with FFTshift for both negative & positive frequencies
figure(2);
plot(freq, (Hf_Rectangular(1:length(freq)))/max(Hf_Rectangular));
xlabel('f/F');
ylabel('H(F)');
title('Frequency Response of Rectangular Filter');
grid on,
%% Power Spectral Density
[PSD_Rectangular, F_Rectangular] = periodogram (ht_Rectangular, [], length (ht_Rectangular));
figure(3);
plot (F_Rectangular, 10 * log10 (PSD_Rectangular));
xlabel('f/F');
ylabel('PSD (dB)');
title('Power Spectral Density of Rectangular Filter');
grid on,

回答 (1 件)

Nitin Kapgate
Nitin Kapgate 2021 年 1 月 13 日
You can use the "bandpower" function to calculate the stop band energy from PSD as illustrated in this example.
  1 件のコメント
Sara Nasir
Sara Nasir 2021 年 2 月 23 日
It is for calculating the average power, not the sub-band energy

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParametric Spectral Estimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by