In: Computer Science
***Please solve on MATLAB:***
Consider the signal x(t) = 2−tu(t), where u(t) is
the unit step function.
a) Plot x(t) over (−1 ≤ t ≤ 1).
b) Plot 0.5x(1 − 2t) over
(−1 ≤ t ≤ 1).
(a)
% Code to plot the signal x(t) = 2-tu(t), where u(t) is unit step function
% We will use heaviside function for unit step function
% Part (a) for -1<= t <=1
t = -1:0.1:1;
x = 2 - t.*(heaviside(t));
plot(t,x, 'linewidth', 2)
(b)
% Code to plot the signal 0.5x(1-2t) over -1<= t <=1
t = -1:0.1:1;
x = 2 - t.*(heaviside(t));
plot(t, 0.5*x.*(1 - 2.*t))
_______________________________________________________________________________
*NOTE: Drop comments for queries.