I'm trying to write a gaussian pulse function which you can see in the picture (named g(t)) or below. Gaussian pulse
g(t) = rect(t/T)exp((-(t-t0)^2)/(sigma)^2)exp(i2pif_ct)
Where -t is the time and my variable for my x axis -t0,sigma and f_c are variables that can change according to what result you want (I put them as input() in the code) -T is the interval of time between mesures
I'm using on Jupyter notebook in Python 3. While trying to write my function, I have this error in the line where I name my var "partie1" : ufunc 'subtract' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32'). I did some research, but none of them work and I'm still unsure of waht exactly this error means.
Here's my code: #1.Définir la fonction g_t
#1.1 Définir la fonction rect et ces variables
T=500
t= np.arange(start=-0.2,stop=0.2,step=(1/T))
for i in range(len(t)):
if abs(t[i]<=(T/2)):
rect=1
else:
rect=0
#1.2 Définir la partie exponantielle et ces variables
i = complex(0,1)
t0 = input('Entrer la valeur de t0')
sigma = input('Entrer la valeur de sigma')
f_c = input('Entrer la valeur de f_c')
partie1 = math.exp((-(t-t0)**2)/((sigma)**2))
partie2 = math.exp((i*2*pi*f_c)*t)
#1.3 Définir la fonction g_t
g_t = partie1*partie2*rect
Thank you! :)