digital filters and DFT

3 visualizaciones (últimos 30 días)
Jone Erikson
Jone Erikson el 8 de Nov. de 2020
Respondida: Suraj Kumar el 11 de Abr. de 2025
how can I use frequency sampling to design a length-19 FIR lowpass filter with cutoff 0.25π. by not usingfir2. I am trying to determine the desired DFT sample values from the specified cutoff , and then take the inverse FFT (ifft). The DFT coefficients must be symmetric to yield a real impulse response. For example, a cutoffof 0.5πand a length of 9 would yield a DFT coefficient vector [1 1 1 0 0 0 0 1 1] correspondingto the frequency values 2*pi*[0 1/9 2/9 3/9 4/9 5/9 6/9 7/9 8/9]. The k=0 value is the first entry in the vector. Also, the impulse response must be circularly shifted so the origin isin the middle instead of at 0. Then, Plot the impulse response, magnitude response, and zero-polelocations. Can Someone help with that please

Respuestas (1)

Suraj Kumar
Suraj Kumar el 11 de Abr. de 2025
Hi Jone,
To design a length-19 FIR lowpass filter using frequency sampling and the inverse FFT without using 'fir2', you can refer to the following steps and the attached code snippets:
1. You create a symmetric DFT vector for a filter length of 19 and set values to 1 for frequencies below the cutoff and 0 for those above, using the frequency vector.
N = 19;
cutoff = 0.25;
k = 0:(N-1);
H = zeros(1, N);
H(k <= cutoff * N) = 1;
H(k >= N - cutoff * N) = 1;
H = fftshift(H);
2. Then you can use the inverse FFT to get the impulse response and apply a circular shift to center it.
h = ifft(H, 'symmetric');
h = circshift(h, -floor(N/2));
3. Finally you can plot the impulse response, magnitude response, and zero-pole locations to verify the filter's performance.
figure;
subplot(3,1,1); stem(h, 'filled'); title('Impulse Response');
subplot(3,1,2); freqz(h, 1, 1024); title('Magnitude Response');
subplot(3,1,3); zplane(h, 1); title('Zero-Pole Plot');

Categorías

Más información sobre Digital and Analog Filters en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by