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');



