私は計算上の課題について次のような問題を解決しました。本当に悪いグレード(67%)を得ました。これらの質問を正しく行う方法、特にQ1.bとQ3を理解したいと思います。できるだけ詳細にしてください、私は本当に私のmsitakesを理解したいです計算物理学、FFT解析
データを生成する(正弦関数)。 fftを使用して分析する: a)一定であるが異なる周波数を有する3つの波の重畳 b)周波数が時間に依存する波 グラフ、サンプル周波数、振幅およびパワースペクトルを適切な軸でプロットする。
練習1a)の3つの波を使用しますが、周波数、位相、振幅が同じになるように変更してください。ランダムにガウス分布した雑音の連続的に増加する量でそれぞれを汚染してください。 1)ノイズが混入した3つの波を重ね合わせてFFTを実行します。 出力を解析してプロットします。 2)ガウス関数で信号をフィルタリングし、 "クリーンな"波をプロットし、 の結果を分析します。結果の波は100%きれいですか?説明する。
#1(b)
tmin = -2*pi
tmax - 2*pi
delta = 0.01
t = arange(tmin, tmax, delta)
y = sin(2.5*t*t)
plot(t, y, '-')
title('Figure 2: Plotting a wave whose frequency depends on time ')
xlabel('Time (s)')
ylabel('Y(t)')
show()
#b.2
Fs = 150.0; # sampling rate
Ts = 1.0/Fs; # sampling interval
t = np.arange(0,1,Ts) # time vector
ff = 5; # frequency of the signal
y = np.sin(2*np.pi*ff*t)
n = len(y) # length of the signal
k = np.arange(n)
T = n/Fs
frq = k/T # two sides frequency range
frq = frq[range(n/2)] # one side frequency range
Y = np.fft.fft(y)/n # fft computing and normalization
Y = Y[range(n/2)]
#Time vs. Amplitude
plot(t,y)
title('Figure 2: Time vs. Amplitude')
xlabel('Time')
ylabel('Amplitude')
plt.show()
#Amplitude Spectrum
plot(frq,abs(Y),'r')
title('Figure 2a: Amplitude Spectrum')
xlabel('Freq (Hz)')
ylabel('amplitude spectrum')
plt.show()
#Power Spectrum
plot(frq,abs(Y)**2,'r')
title('Figure 2b: Power Spectrum')
xlabel('Freq (Hz)')
ylabel('power spectrum')
plt.show()
#Exercise 3:
#part 1
t = np.linspace(-0.5*pi,0.5*pi,1000)
#contaminating our waves with successively increasing white noise
y_1 = sin(15*t) + np.random.normal(0,0.2*pi,1000)
y_2 = sin(15*t) + np.random.normal(0,0.3*pi,1000)
y_3 = sin(15*t) + np.random.normal(0,0.4*pi,1000)
y = y_1 + y_2 + y_3 # superposition of three contaminated waves
#Plotting the figure
plot(t,y,'-')
title('A superposition of three waves contaminated with Gaussian Noise')
xlabel('Time (s)')
ylabel('Y(t)')
show()
delta = pi/1000.0
n = len(y) ## calculate frequency in Hz
freq = fftfreq(n, delta) # Computing the FFT
Freq = fftfreq(len(y), delta) #Using Fast Fourier Transformation to #calculate frequencies
N = len(Freq)
fr = Freq[1:len(Freq)/2.0]
A = fft(y)
XF = A[1:len(A)/2.0]/float(len(A[1:len(A)/2.0]))
# Amplitude spectrum for contaminated waves
plt.plot(fr, abs(XF))
title('Figure 3a : Amplitude spectrum with Gaussian Noise')
xlabel('frequency')
ylabel('Amplitude')
show()
# Power spectrum for contaminated waves
plt.plot(fr,abs(XF)**2)
title('Figure 3b: Power spectrum with Gaussian Noise')
xlabel('frequency(cycles/year)')
ylabel('Power')
show()
# part 2
F_v = exp(-(abs(freq)-2)**2/2*0.5**2)
spectrum = A*F_v #Applying the Gaussian Filter to clean our waves
new_y = ifft(spectrum) #Computing the inverse FFT
plot(t,new_y,'-')
title('A superposition of three waves after Noise Filtering')
xlabel('Time (s)')
ylabel('Y(t)')
show()
ようこそ。あなたが間違っていたことをグレーターに聞いたことがありますか?私たちは通常、「なぜこの複雑な複数のパートの割り当てに関して悪い成績を取ったのですか?」というような幅広い質問には答えません。投票を終了する。 – Beta
最善の方法は、おそらく教師/ TAにうまくいけば何が問題だったかということです。 –
私は質問がうまくいき、ミス(タスクからの逸脱)が見やすいと思います。実際の関数のFFTがpos/neg周波数で対称になるという理由から、同じタスクを複数回実行して、実際にFFTの考え方を理解することをお勧めします。最も重要なことは、周波数間隔が時間範囲の逆数であり、周波数範囲(neg + pos together)が時間間隔の逆数であることを認識することです。したがって、サンプリング定理は、FFTが計算する周波数において正確に満たされる。 – roadrunner66