I have a problem with use if
and else
statement in convolution function.
this code return error:
use any() or all()
import matplotlib.pyplot as plt
import numpy as np
def name(y):
if y<300 :
print("if")
fun2=y-6
return fun2
else:
fun2=6-y
print("else")
return fun2
y=np.arange(1,1000,1)
x=np.arange(1,1000,1)
fun1=np.sin(x)
con=np.convolve(fun1,name(y))
plt.plot(con)
plt.show()
how to can i use condition in convolve?
I hope you always good luck. thanks.