%% freqrespplot.m %% plot filter and frequency reponse %% nagmitude and phase %define sample rate, frequencydomain, and filter N = 128; FD = (0:(N-1))-N/2; L = [1,1]/2; n = size(L,2); Lp = [L,zeros(1,N-n)]; % get dft and frequency domain fL = fftshift(fft(Lp)); % display results subplot(3,1,1) stem(0:(n-1),L,'filled') title('filter in stem plot form'); subplot(3,1,2) plot(FD,abs(fL),'r') title('magnitude of filter DFT'); axis tight subplot(3,1,3) plot(FD,angle(fL),'r') title('phase of filter DFT'); axis tight