Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: how to create graphic in matplotlib

1. ## how to create graphic in matplotlib

Hello, I have the following question that is the subject: Fundamentals of Signals and Systems,

• Generate a MATLAB graph of the output response and y[n], for 5 <= n <= 40 of the filter
• PMPE in point 5, with b = 0.7, when the input x[n] is:
a) x[n] = 1, 0 <= n <=40
b) x[n] = n, 0 <= n <= 40

result of a)
Code:
```import numpy as np
from matplotlib import pyplot as plt
N = 40
x = np.ones(N+1)
b = 0.7
S = 5
a =(1 - b) / (1-b**S)
i = np.arange(1,S+1)

w = a * (b**(S-i))
# print(w)
y = np.zeros(N)
y[S-1:] = [ np.dot(w, x[n-S+1:n+1].T) for n in range(S-1, N)]
print(y)
print(len(y))
plt.plot(range(S, N+1),y[S-1:], marker='o')
plt.plot(range(S, N+1),y[S-1:], linestyle='-')
plt.show()```

now I do not know how to do part b)

2. Well, I found the solution, it was only to make this change
Code:
`x = np.one(N+1)`
to
Code:
`x = np.arange(N)`