In: Electrical Engineering
Find frequency response of the system given by following equation using MATLAB. Clearly plot both amplitude and phase response waveforms with labels assigned.
y[n+1]-0.5 y[n]=x[n]
Matlab code would be greatly appreciated
The difference equation of the system is given by

Taking Z transform on both sides, we get

We have used the time shifting property of Z transform which states that
If

Then




So the system function is


MATLAB Code
clc;
clear all;
close all;
b = [1]; % Numerator coefficients of H(z)
a = [1, -0.5]; % Demoninator coefficients of H(z)
freqz(b,a); % Find and plot the magnitude and phase
response
The plot obtained

You can also find the magnitude and phase response analytically as follows

The frequency response of the system will be obtained by putting




Taking the magnitude, we get






So the magnitude response of the system is

To find the phase response


So the phase response is
