2017-07-28 4 views
0

私は単純な(高速フーリエ変換)fftを試みて、それを元に戻しますが、動作しません。 各コンポーネントにフェーズを追加するには、この作業を開始する必要があります。あなたは見てみて、私がこれで間違っているところを見てくださいできますか?fft matlab freqとbackへの時間

[email protected](t) cos(1.5e12*t) 
nttf=2^17; 
t=linspace(-3*t_signal_pulse/2,3*t_signal_pulse/2,nttf); 
dni_ni=(1/(t(2)-t(1))); 
ni=-dni_ni/2:dni_ni/(nttf):dni_ni/2-dni_ni/(nttf); 
w=ni.*2*pi; 
figure(1) 
plot(t,fun_cos(t)) 
FFt_cos=fftshift(fft(fun_cos(t),nttf))/length(t); 
figure(2); 
plot(w,abs(FFt_cos)) 
fft_back=ifft(ifftshift(FFt_cos)); 
figure(1) 
hold on 
plot(t,abs(fft_back),'.r') 

Freq domain. you can see here two freq even though I only need one

Final result. The blue is the original cosine and the red is the one that I would expected to be the same

私は個別に時間ドメインと周波数ドメインの両方に位相を追加したい場合にも、(私はFREQの片側を知っていることに注意してください。ドメイン段階と両方ではないので、「)の長さ(T」あなたがして再スケールするのを忘れ

+0

[mcve]を提供してください。また、結果が有用かもしれません。 – m7913d

+0

は結果を写真に追加しました。青は元の機能です。赤は私が同じだと思っているが、あなたが言うことができると思うもので、それは – elis02

答えて

2

)まだこのを続行する方法がわからない:

fft_back=ifft(ifftshift(FFt_cos*length(t))); 

MaxError=max(abs(fun_cos(t)-fft_back)) %reconstruction error 
+0

ありがとう。 これは機能します。 – elis02