Question

# 1. Write a MATLAB function to determine the discrete-time Fourier Transform (H(?)) of the following sequence....

1. Write a MATLAB function to determine the discrete-time Fourier Transform (H(?)) of the following sequence. Plot its magnitude and phase. You can use the dtft command and use the abs, angle and plot commands to plot the results.

x(n) = {4, 3, 2, 1, 2, 3, 4}.

2. Analytically determine H(z) and plot its magnitude and phase for the following system using freqz.

y(n) = 2x(n) + x(n ? 1) ? 0.25y(n ? 1) + 0.25y(n ? 2).

3. By using the “fvtool” command you can see the magnitude and phase response of H(?), the zero-pole locations, impulse response, stability of the system and much more. (Note that the magnitude is in dB which is OK). Note that the “freqz” function will also return the magnitude and phase of H(?) when the parameters of H(z) are given but additional commands are needed for plotting the values. Plot the following using “fvtool”.

a) Assume that H(z) has a pole at z = 0.7 and a zero at z = a. Plot the magnitude and phase response of H(?) for all the following cases of a = -3, -1,-0.5, 0.65, 0.7, 0.8, 1, 1.5, 3. This will show the effect of the location of the zero on the frequency response. Explain what you have observed.

b) Assume H(z) has to zeros at ej?/4 and e-j?/4 and two poles both at z = c. Analytically find H(z) and use Matlab to show the changes in |H(?)| for c = -0.9, -0.2, 0.2, 0.7, 0.95. Show the zero-pole plot for each case as well and explain the effect of the location of the double poles on the filter type.

matlab code for min_dft.m

x = [4 3 2 1 2 3 4];
n = 0:length(x)-1;
w = 2*pi*(0:0.001:length(x)-1)/length(x);
X = dfft(x,n,w);
subplot(2,1,1)
plot(w,abs(X))
ylabel 'Amplitude'
grid on
subplot(2,1,2)
plot(w,angle(X))
ylabel 'Phase'
grid on

--------------------------

code for dfft.m

function [ X ] = dfft( x, n, w )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
X = x*exp(-j*n'*w);

end

-------------------------------------------