24 lines
559 B
Python
24 lines
559 B
Python
import numpy as np
|
|
import scipy as sp
|
|
import matplotlib.pyplot as plt
|
|
|
|
def main():
|
|
n = np.arange(100) # First 100 samples
|
|
|
|
y_1 = (1 - 0.95**(n+1))/0.05 # Output of system for input x[n] = 0.95^n u[n]
|
|
y_2 = n + 1 # Output of system for input x[n] = u[n]
|
|
|
|
plt.stem(n, y_1) # Plot y_1[n]
|
|
plt.xlabel("n")
|
|
plt.ylabel("y[n]")
|
|
plt.show()
|
|
|
|
plt.stem(n, y_2) # Plot y_2[n]
|
|
plt.xlabel("n")
|
|
plt.ylabel("y[n]")
|
|
plt.show()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|