Hanning window Frequency Domain Graph

22 ビュー (過去 30 日間)
Sara Nasir
Sara Nasir 2020 年 9 月 1 日
編集済み: Leo Dokoza 2021 年 3 月 7 日
Hello,
I have calculated the time domain of the hanning window through the formula.
But now I have to find the frequency domain by using fft and fft shift which i have calculated but I want to know is this graph correct or not?
M = 40;
n = -M / 2: M / 2;
window = 0.5 + 0.5 * cos (2 * pi * n / M);
figure;
plot (n, window);
L = length (window);
NFFT = 1024;
X1 = fftshift (fft (window, NFFT) / length (window));
Freq = (-NFFT / 2: NFFT / 2-1) / NFFT; % Frequency vector
figure;
plot (Freq, X1 (1: length (Freq)) / max (X1), 'r' );

採用された回答

Pratyush Roy
Pratyush Roy 2020 年 9 月 22 日
The graph for frequency response is correct. In case you want to generate a plot for magnitude response in decibels, make the following changes to the code:
Y1 = X1 (1: length (Freq)) / max (X1);
mag_dB = 10*log10(Y1);
plot(Freq,mag_dB);
The following link to the documentation might be helpful ofr generating frequency response for Hanning window using the 'hann' function available in the Signal Processing Toolbox in MATLAB.

その他の回答 (1 件)

Leo Dokoza
Leo Dokoza 2021 年 3 月 7 日
編集済み: Leo Dokoza 2021 年 3 月 7 日
What does "M" stand for? Could you explain your code?

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by