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

조회 수: 8 (최근 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.

카테고리

Help CenterFile Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by