필터 지우기
필터 지우기

How to implement rectangular and welch window in MATLAB to plot fft respectively?

조회 수: 6 (최근 30일)
Hello Everybody,
I just want to know that how to implement rectangular and welch window in MATLAB to plot fft? And i want to know that what will be the effect if i do not use these in our fft? I have written the following code so please suggest how to specify rectangular and welch window in this code.
I = load('data1.asc');
for i = 1:2048
x = I(:,2);
end
Fs = 40;
t = 0:1/Fs:(2e3*1/Fs)-1/Fs;
T = 1/Fs;
L = 2048;
NFFT = 2^nextpow2(L);
Y = abs(fft(x,NFFT))/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
plot(f,2*abs(Y(1:NFFT/2+1)))
axis([0 50 0 40])

답변 (2개)

Honglei Chen
Honglei Chen 2013년 7월 23일
Rectangular window is the same as no window. For Welch window, you can find it on file exchange at
(Disclaimer: I haven't personally used it so I cannot comment on its quality)
If you have a window, w, you just need to do the following in your code instead:
Y = abs(fft(x.*w,NFFT))/L;

Deyan Dobromirov
Deyan Dobromirov 2021년 2월 7일
The implementation fails to create zeros at both ends. Here is my version:
function w = welchwin(n)
m = floor(n/2); k = (0:m-1)';
w = 1 - (2*k/n - 1).^2;
if(mod(n, 2) ~= 0), w = [w; 1]; end
w = [w; flipud(w(1:m, 1))];
end

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by