傅里叶变换相角不匹配

时间:2014-09-11 13:44:31

标签: python python-2.7 signal-processing

我试图在频率Vs相角的傅里叶变换图中获得相位角的提供值。频率Vs相位角在所需频率处变得不连续,相位角的值在图中也是正确的。

from scipy import *

import sys

from math import atan2

x=arange(-10, 10,0.01)

T   = 0.1

f = 1/T

omega = 2*pi/T

amp = 0.3

y1=2*amp*sin(omega*x + float(sys.argv[1])*pi/180.)

y2=amp*sin(3*omega*x + pi/4)

y = y1+y2

from scipy.fftpack import fft, fftfreq, fftshift

fft_y = fft(y)

im = imag(fft_y)

r = real(fft_y)

angle=arctan2(im,r)

angle1 = fftshift(angle)

Amp= ((fftshift(abs(fft_y)))/len(y))*2

q     = fftshift(fftfreq(len(x), x[1]-x[0]))


from pylab import *

figure(1)

plot(x, y,'ro-')

figure(2)

plot(q, Amp, 'ro-')

figure(3)

plot(q, angle1*180/pi, 'g-')

show()

0 个答案:

没有答案