Using the facilities of numpy, write a python program that reads the input signal as a space separated sequence of numbers on one line, and the system impulse response as a space separated sequence of numbers on the next line, and outputs (on one line) the output of the DT LTI system.
The input lines should be interpreted as
x[0] x[1] x[2] ... x[N-1] h[0] h[1] h[2] ... h[M-1]
and the output should be produced in the same order:
y[0] y[1] y[2] ... y[S-1]
where S is related to N and M.
I can help you.
But there is a small confusion in your question. You dosent told how the calculation of
y[0] y[1] y[2] ... y[S-1]
has to be done.(specify it in the comments, I will update the answer based on that)
You can read the lines in and convert to each input as follows
Program :
import numpu as np
x = input("Enter signals : (x[0] x[1] x[2] ... x[N-1]) : ")
x = x.split() # This line will seperate each signals and store as an array
h = input("Enter system impulse response : (h[0] h[1] h[2] ... h[M-1]) : ")
h = h.split() # This line will seperate each system impulse response and store as an array
# Find the length of each data
N = len(x)
M = len(h)
# Convert the list to numpy array, For easy computations:
x = numpy.array(x)
h = numpy.array(h)
Now for the final computation,
Please give the details, how to compute the y,
I will update the answer based on your response.
Get Answers For Free
Most questions answered within 1 hours.