$x_1[n]=0.9\delta[n-5]$ in Matlab (Checkm

1.1k Views Asked by At

I have never used matlab before and just started working on my first exercise and don't have a clue what I am doing. I would appreciate any pointers to let me know if what I am doing is write or wrong.

The Question:
Generate and plot the following sequence. In each case the horizontal $(n)$ axis should extend only over the range indicated and should be labels accordingly. Each sequence should be displayed as a discrete-time signal using stem.

$x_1[n]=0.9\delta[n-5] \qquad 1\le n \le 20$

My answer:

EDU>> L=20;
EDU>> nn=0.9:(L-5);
EDU>> stem(nn);

Matlab stem plot

Is this even remotely correct?

2

There are 2 best solutions below

0
On BEST ANSWER

Presumably $\delta$ refers to the Dirac delta function.

Try

L = 20;
x1 = zeros(1,L);
x1(5) = 0.9;
stem(x1);
0
On

Is $\delta[n]$ a discrete Dirac delta function, i would suppose that, if it does that is absolutely wrong, note that your function is a shifted-scaled version of the original sequence, so your function should be the $\delta[n]$ on 5 with a length of 0.9, If that is not your interpretation of $\delta[n]$, i think you should provide some definitions,. I am thinking and defining stuffs using DSP, digital filters notation