EE342.01: MATLAB M-FILE FOR PLOTTING DISCRETE-TIME COMBINATION SIGNAL

MATLAB M-File example3.m:
%
% Filename: example3.m
%
% Description: This m-file plots the discrete-time signal
%              x[n] = 2d[n+2] - d[n] + e^n(u[n+1] - u[n-2]).
%

clear; clf;                     % clear matlab memory and figure

n=-3:3;                         % define DT variable
x = 2*((n>=-2)-(n>=-1)) ...     % define DT signal
    - ((n>=0)-(n>=1)) ...
    + exp(n).*((n>=-1)-(n>=2));

stem(n,x,'filled');             % plot signal
xlabel('n'); ylabel('x[n]');
title('Plot of Combination Signal');
MATLAB Plot Generated: