Fourier transform of discrete and continous signals


Assignment:

Question 1. A discrete-time system has the following unit-pulse response: h[n] = 0.5^n – 0.25^n …….     for n ≥ 0

Correspondingly, the following difference equation describes the behavior of the system:
y[n+2] – 0.75y[n+1] + 0.125y[n] = 0.25x[n+1}

A. Use the MATLAB command conv to calculate the response of the system to a unit step input, x[n]=u[n]. Consider 0≤ n ≤ 20. Show what you type into the MATLAB command window and submit a plot of the output. Please label the axes.

B. Use the MATLAB script recur to calculate the response of the system to a unit step input, x[n]=u[n]. Again consider 0≤ n ≤ 20. Show all that you type into the MATLAB command window. Submit a plot of the output with the axes labeled.

Recur function
function y = recur(a,b,n,x,x0,y0);
%
% y = recur(a,b,n,x,x0,y0)
% solves for y[n] from:
% y[n] + a1*y[n-1] + a2*y[n-2]... + an*y[n-N]
% = b0*x[n] + b1*x[n-1] + ... + bm*x[n-M]
%
% a, b, n, x, x0 and y0 are vectors
% a = [a1 a2 ... aN]
% b = [b0 b1 ... bM]
% n contains the time values for which the solution will be computed
% y0 contains the initial conditions for y, in order,
% i.e., y0 = [y[n0-N], y[n0-N+1], ...,y[n0-1]]
% where n0 represents the first element of n
% x0 contains the initial conditions on x, in order
% i.e., x0 = [x[n0-M],...,x[n0-1]]
% the output, y, has length(n)
%
N = length(a);
M = length(b)-1;.EE381 Lab CG – Signals and Systems Theory 17
if length(y0) ~= N,
error('Lengths of a and y0 must match')
end
if length(x0) ~= M,
error('Length of x0 must match length of b-1')
end
y = [y0 zeros(1,length(n))];
x = [x0 x];
a1 = a(length(a):-1:1); % reverses the elements in a
b1 = b(length(b):-1:1);
for i=N+1:N+length(n),
y(i) = -a1*y(i-N:i-1)' + b1*x(i-N:i-N+M)';
end
y = y(N+1:N+length(n));

Question 2. The continuous time function. This signal is a sin c function defined as y(t) = sinc(t). The Fourier transform of this signal is a
rectangle function.

1. Use the function linspace to create a vector of time values from -5 ≤t ≤5. Next, plot the function using the sinc function for y(t) = sinc(t).
2. Using MATLAB and the command fft, show that the Fourier transform pair is indeed a rectangle function. Use the commandfftshift to center your plot.. Show both the m-file code and plot.

3. Using the same time values, plot the continuous time function defined as y(t) = sinc(2t).
4. Plot the transform pair for this signal.

Problems:

1. What is the “ringing” caused from seen on top of the rectangular pulse?
2. In step 3 above, the sinc function gets compressed or smaller by a factor of 2. What happened to the rectangular pulse in the frequency domain? What property does this relate to?

Please be sure to submit code and plots.

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Fourier transform of discrete and continous signals
Reference No:- TGS01897615

Now Priced at $30 (50% Discount)

Recommended (93%)

Rated (4.5/5)