How do I add a Hanning Window to this code before I FFT it?

223 ビュー (過去 30 日間)
Paul Clarkson
Paul Clarkson 2017 年 10 月 19 日
回答済み: Shivam Bahuguna 2020 年 8 月 19 日
Hi,
I've heard adding a Hanning Window can help with data processing before you apply a Fourier Transform. With the code I have below, where can I add such a window?
Any help would be greatly appreciated.
a=dlmread('Ethanol_05273.txt');
alex_x=a(873:2048,1)/1000;
alex_y=a(873:2048,2);
plot(alex_x,alex_y); grid on;
alex_x_f=10000./alex_x;
F=linspace(min(alex_x_f),max(alex_x_f),1024);
alex_y_f=interp1(10000./alex_x,alex_y,F,'pchip');
FT=fft(alex_y_f);
figure;
plot(abs(FT));

採用された回答

dpb
dpb 2017 年 10 月 19 日
編集済み: dpb 2017 年 10 月 19 日
FT=fft(hanning(length(alex_y_f)).*alex_y_f);
presuming your data are vectors. If not, use the proper array dimension for length() of window, of course.
See
doc hanning % details on windowing

その他の回答 (2 件)

Paul Clarkson
Paul Clarkson 2017 年 10 月 20 日
Thank you!

Shivam Bahuguna
Shivam Bahuguna 2020 年 8 月 19 日
How to take care of the window ccorrection factor while doing this?

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by