Digital Signal Processing Reference
In-Depth Information
>> mymax(x2)
ans =
4.5000
4. Find y 1 [n] = x 1 [n]:9x 1 [n1], using x 1 from above.
Plot y 1 (adjusting t as needed).
Answer:
Array t does not need to be adjusted, but we have to be careful about n. That
is, x 1 [n1] does not exist when n = 1 (MATLAB will not let us index an
array at location 0). Therefore, we have to start n at 2, so that n1 is a valid
array value. Also, notice that we use parentheses for MATLAB code, in place
of the square brackets.
for n=2:length(x1)
y1(n) = x1(n) - .9 * x1(n-1);
end
plot(y1)
5. Create y 2 [n] to be the average of the current and previous two values of x 2 [n].
Plot y 2 .
Answer:
We have to be careful with our starting value for n, as in the problem above.
for n=3:length(x2)
y2(n) = (x2(n) + x2(n-1) + x2(n-2))/3;
end
plot(y2)
6. Create y 3 [n] = x 2 [n]y 3 [n1].
Plot y 3 .
What will happen as n approaches innity?
Search WWH ::




Custom Search