212k views
5 votes
Matlab help !!!

In this practice, you will be considering a discrete time system
related by y[n]=(x[n])^2.
determine if the discrete time system y[n] is time invariant.
Let the input signal x[n]=0.8^n
% closes all figure windows % clears all variables % clear the command window close all; clear all; clc; n=- 10:10; x = [replace this with your own code] y= [replace this with your own code] xShift3 =

1 Answer

4 votes
To determine if the discrete time system y[n]=(x[n])^2 is time-invariant, we need to check if a time shift in the input signal x[n] causes a corresponding time shift in the output signal y[n].

Let's consider two input signals x1[n] and x2[n], where x1[n] = x[n - k] and x2[n] = x[n - k - m], where k and m are integers representing the time shift. Then the corresponding output signals are y1[n] = (x1[n])^2 and y2[n] = (x2[n])^2.

Substituting the expressions for x1[n] and x2[n], we get:

y1[n] = (x[n - k])^2
y2[n] = (x[n - k - m])^2

Now, let's consider the time-shifted output signal y1[n - m]:

y1[n - m] = (x[n - k - m])^2

Comparing y1[n - m] and y2[n], we can see that y1[n - m] = y2[n], which means that the output signal is shifted by the same amount as the input signal. Therefore, the discrete time system y[n] = (x[n])^2 is time-invariant.

Now, let's calculate the output signal y[n] for the given input signal x[n] = 0.8^n:

x = 0.8.^n;
y = x.^2;

We can then shift the input signal by 3 units to the right using:

xShift3 = [zeros(1,3), x(1:end-3)];

This shifts the input signal x[n] to x[n - 3], which should correspond to a time shift of 3 in the output signal. We can calculate the output signal for the shifted input signal using:

yShift3 = xShift3.^2;

Finally, we can plot the original and shifted output signals using:

stem(n, y);
hold on;
stem(n, yShift3);
legend('y[n]', 'y[n-3]');
xlabel('n');
ylabel('y[n]');
title('Output signals for original and shifted inputs');
User Pat Lillis
by
8.2k points