![](/img/trans.png)
[英]increase / decrease the frequency of a signal using fft and ifft in matlab / octave
[英]MATLAB: FFT a signal to frequency and IFFT back to time domain, not exactly the first signal
我試圖重現約30飛秒激光脈沖的變化。 我創建並及時顯示此脈沖。 此外,在Matlab上此脈沖的fft值也很好(中心頻率和寬度非常好)。 但是,當我使用ifft()函數對轉換后的波形進行逆變換時,脈沖會隨時間移動(可能是由於相位變化?我不知道),並且峰值最大值也有所不同。 ? 我使用錯誤的ifft方法?
我正在使用的代碼是這樣的:
atto=1e-18;
c = 299792458;
femto=1e-15;
lamda0=800e-9;
f_0=c/lamda0;
omega0=2*pi*c/lamda0;
T=2*pi/omega0;
a=2*log(2)/((36.32*femto)^2);
Fs=3/atto; %samplying rate
t=-200*femto:1/Fs:200*femto;
Efield=exp(-a.*(t-T).^2).*exp(1j.*omega0.*(t-T));
nfft=2^nextpow2(length(Efield));
Efieldfft=fft(Efield,nfft);
f=(0:nfft-1)*Fs/nfft;
omega=2*pi*f;
figure(1)
plot(t,Efield)
xlabel('s [fs]')
ylabel('Amplitude')
figure(2)
plot(omega,abs(Efieldfft))
xlim([2e15 2.8e15])
xlabel('omega [rad]')
ylabel('Amplitude')
figure(3)
plot(f,abs(Efieldfft))
xlim([3.3e14 4.1e14])
xlabel('frequency [Hz]')
ylabel('Power')
test=ifft(Efieldfft,length(t));
figure(4)
plot(t,test)
xlabel('s[fs]')
ylabel('amplitude')
這是因為與時間軸的長度相比,您正在修改FFT的長度。 要看到這個,更換
nfft=2^nextpow2(length(Efield));
通過
nfft=length(Efield);
您會發現圖1和圖4現在相等,直到數值精度誤差為止。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.