Linear and nonlinear phase low pass filter
Linear and non linear low pass filter with cut off freq 0.3pi rad. Magnitude response, phase response and group delay of both filters is also plotted
%% FIR & IIR filter
% Initializatoin
clc
clear all
close all
%% FIR linear phase low pass filter
h=remez(60, [0 0.25 0.3 1], [1 1 0 0]);
fvtool(h,1)
%% IIR nonlinear phase low pass filter
[b a]=cheby2(20,35,0.3);
fvtool(b,a)
%% Filtering x(n)
x=zeros(1,200);
x(1:30)=1;
y1=filter(h,1,x);
y2=filter(b,a,x);
figure
plot(y1,'b','linewidth',2)
hold on
plot(y2,'r','linewidth',2)
xlabel('Samples')
ylabel('Amplitude')
title('Output of filters for input x(n)')
legend('FIR linear phase LPF output','IIR nonlinear phase LPF filter output')