I am trying convolution of two signals after finding the polynomial coefficients of the signals. But I guess when I try to fit the values from the convolution to plot the graph, I am making a mistake. Can anyone please help?
Thanks.
from numpy.polynomial import Polynomial as poly
import numpy as np
import matplotlib.pyplot as plt
no_of_coef= 10
#original signal
x = np.linspace(0, 0.01, 10)
period = 0.01
y1 = np.sin(np.pi * x / period)
test1= np.polyfit(x,y1,no_of_coef)
coef_y1 = np.polyval(test1,x)
#filter
y2= [0,1,1,1,1,1,1,1,1,0]
test2= np.polyfit(x, y2, no_of_coef)
coef_y2= np.polyval(test2, x)
#convolution
signal_filter_convolution= np.convolve(coef_y1[::-1], coef_y2[::-1])
print(signal_filter_convolution)
convolution_fit= np.polyval(signal_filter_convolution, x)
plt.plot(x, coef_y1)
plt.plot(x,y2)
plt.plot(x, convolution_fit)