I have a problem with understanding the phase response of lowpass filter in MATLAB(I'm writing my own code not using inbuilt functions to find phase response & Matlab). I am trying to pass sine signals of different frequencies into a lowpass filter with a certain passband frequency. Later, magnitude response is obtained by the change in the output amplitude divided by input amplitude . Whereas phase response is the angle of (output amplitude/input amplitude)???. I am getting correct magnitude response, but my phase response is zero. I don't understand why ??
I mean even though there isnt a phase term in the test signal ,there should be some phase change due to the lowpass filter at least. I almost spent more than two weeks on this and still unable to understand .
Im attaching the graphs for the amplitude response and phase response ,along with the code.
fs=1000;f=1:15;t = 0:1/fs:10-1/fs; x= sin(2*pi*t'*f);[Y,d]= lowpass(x,10,fs); figure; plot(t,x); hold on plot(t,Y);for i=1:15 figure(i); plot(t,x(:,i)); hold on plot(t,Y(:,i)); title ('Original/ Filtered Data') %%%%%%%%% peak to peak amp %%%%%%%%%%%%
input(i)=(rms( x(:,i))/0.707)*2;%%%% inp peak to peak
output(i)=(rms(Y(:,i))/0.707)*2 ;%%%%%% out peak to peak
change(i)=output(i)./input(i);%%%%%% change in out peak to peak to input
phase(i)=angle(change(i));end figure;subplot(2,1,1);plot(f,mag2db(abs(change)));title('Frequency response of the filter using abs(Out/Inp)')xlabel('Frequency');ylabel ('Change in output/input P-P' );subplot(2,1,2);plot(f,phase);title('Phase response of the filter using angle(Out/Inp)')xlabel('Frequency');ylabel ('phase' );
Best Answer