MATLAB: Plot discrete time domain signals

discrete timeMATLABplot

Given n=[-1:0.01:10]. Plot the discrete time domain signal: y[n]=e^(-n)*u(n).
Below is my program but i'm not sure if it's correct since this is my fisrt time learning Matlab. Please help. Thanks!
n=-1:0.01:10;
y=exp(-n).*heaviside(n);
stem(t,y)

Best Answer

I recommend using following substitutions:
plot(t,y)
axis( [-1 10 0 1])