fft関数に使用される窓関数について

fft関数に使用されている窓関数は四角形窓がデフォルトなのでしょうか?
またマトラボではfftにハミング窓を使用されることはできるのでしょうか?

 Accepted Answer

Toshinobu Shintai
Toshinobu Shintai on 23 May 2019

2 votes

Signal Processing Toolboxが必要になりますが、
「hamming」というコマンドで窓関数をかけることができます。
サンプルを作成し添付しましたのでご確認ください。

1 Comment

Kazuya
Kazuya on 23 May 2019
Edited: Kazuya on 23 May 2019
横からすいません。サンプル大変参考になりました。ありがとうございます。fft_window.m あとで参考にしやすいよう以下にコピペさせて頂きます。
clear;
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));
W = (hamming(L))';
X_h = X .* W;
plot(t,X,t,X_h);
figure;
plot(1000*t(1:50),X(1:50));
title('Signal Corrupted with Zero-Mean Random Noise');
xlabel('t (milliseconds)');
ylabel('X(t)');
Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
Y_h = fft(X_h);
P2_h = abs(Y_h/L);
P1_h = P2_h(1:L/2+1);
P1_h(2:end-1) = 2*P1_h(2:end-1);
f = Fs*(0:(L/2))/L;
figure;
plot(f,P1,f,P1_h) ;
title('Single-Sided Amplitude Spectrum of X(t)');
xlabel('f (Hz)');
ylabel('|P1(f)|');

Sign in to comment.

More Answers (1)

Yoshio
Yoshio on 23 May 2019

2 votes

matlab本体のfftは定義のままの変換となりますので、方形窓です。
各種窓については、信号処理ToolBoxに専用の関数があります。以下をご参照ください。

Asked:

on 23 May 2019

Edited:

on 23 May 2019

Community Treasure Hunt

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

Start Hunting!