06 December 2007

Frequency Response of LTI System


Logic

Any LTI system in general can be written as:

y(n)+a1y(n-1)+a2y(n-2)+............ = b0x(n)+b1x(n-1)+........

Frequency response of such a system can be got using the MATLAB command [h,f]=freqz(x,y) where x is the coefficients of x(n) and y is the coefficients of y(n). The command returns the magnitude and phase response to 'h' and the sampling frequency to 'f'. Using "abs (h)" and "angle (h)" commands we can plot the magnitude and response respectively.

Note that "filter" command can't be used here since there is no particular input x(n) is applied to the system. Therefore to find the frequency response of any system like this one given, in general, we go for "freqz" command.

Algorithm:

  1. Input the coefficients of x(n)
  2. Input the coefficients of y(n)
  3. Calculate the frequency response using "freqz" command
  4. Plot the magnitude and phase plot.

Program


%Program to find frequency response of a given LTI system

x=input ('Enter the coefficients of x(n) ');

y=input (' Enter the coefficients of y(n)');

(h,f)=freqz(x,y); % to find frequency response

subplot(2,1,1);

plot(f ./pi, abs(h)); %plot magnitude plot

ylabel('magnitude');

xlabel('numerated frequency');

subplot(2,1,2);

plot(f./pi, angle(h)); %plot phase response

xlabel('normalized frequency');

ylabel('phase in radians');

No comments:

Post a Comment

Your Comments... (comments are moderated)