MATLAB has a function similar to the discrete-time unit step called heaviside
.
The difference is that at the origin, the heaviside function has value of 1/2 instead of 1.
Please don't use the heaviside
function for the discrete-time unit step function.
MATLAB had a function to implement the discrete-time unit step function u[n]
called stepfun
but it is obsolete.
You can mimic u[n] using comparison operations in MATLAB.
In MATLAB, a comparison operation will return 1 if true and 0 if false.
For example,
1 >= 0returns 1, and
-1 >= 0returns 0. Also,
[-1 0 1] >= 0returns [0 1 1]. We can implement u[n] where n could be a vector as
n >= 0In MATLAB, we could express (1/2)n u[n] for -5 ≤ n ≤ 10 as follows:
n = -5:10; unitstep = ( n >= 0 ); x = ((0.5).^n) .* unitstep;
You are asked to find the value of the output y2[n] given the input x2[n] based on the knowledge that the system responds with output y1[n] = d[n] + 2 d[n - 1] - d[n - 2] to the input x1[n] = u[n], where d[n] is the discrete-time unit impulse.
In part (a), you're asked to determine the output y2[n] given the input x2[n] based on the the knowledge that system has linearity and time-invariance (LTI) properties and based on the response y1[n] to the input x1[n]. A system that satisfies the linearity property also satisfies the homogeneity and additivity properties.
In part (b), you'll use deconvolution to compute the LTI FIR filter coefficients (i.e. LTI FIR filter impulse response) based on the response y1[n] to the input x1[n]. With knowledge of the LTI FIR filter coefficients, one can compute the output signal given any input signal. You'll then use the LTI FIR filter impulse response to compute the output y2[n] for input x2[n].