Trying to create a filter for a signal i made, but can't seem to get. I keep getting error about '/' whenever i call my filter function.
import numpy as np
from numpy import sqrt
import matplotlib.pyplot as plt
import scipy as sp
import math
def sinyal(N,c,f,p):
y=np.zeros(N)
t=np.linspace(0,2*np.pi,N)
Nf=len(c)
for i in range(Nf):
y+=c[i]*np.sin(f[i]*t)
return y;
def filter (w,wn):
yf=1.0/sqrt(1.0+(w/wn)**(2.0*n))
return yf;
c=[2,5,10]
f=[50, 150, 300]
p=[0,0]
N=2000
w=[50,150,300]
x=np.linspace(0,2.0*math.pi,N)
y=sinyal(N,c,f,p)
yf=filter(w,200)
plt.plot(x[:100],y[:100])
plt.show()