Challenge - 5 Problems
Window Function Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of Hamming window length
What is the length of the vector produced by the following MATLAB code?
win = hamming(10);
length_win = length(win);
MATLAB
win = hamming(10);
length_win = length(win);Attempts:
2 left
💡 Hint
The hamming function creates a window vector with the specified length.
✗ Incorrect
The hamming function with input 10 returns a column vector of length 10. So length(win) is 10.
❓ Predict Output
intermediateOutput of applying window to signal
What is the output of the following MATLAB code?
signal = ones(5,1);
win = hann(5);
result = signal .* win;
MATLAB
signal = ones(5,1); win = hann(5); result = signal .* win;
Attempts:
2 left
💡 Hint
The hann window values for length 5 are [0; 0.5; 1; 0.5; 0].
✗ Incorrect
The hann window of length 5 produces values [0; 0.5; 1; 0.5; 0]. Multiplying by ones vector keeps these values.
❓ Predict Output
advancedOutput of Bartlett window sum
What is the sum of the Bartlett window vector generated by this code?
win = bartlett(5);
total = sum(win);
MATLAB
win = bartlett(5); total = sum(win);
Attempts:
2 left
💡 Hint
Bartlett window is a triangular window starting and ending at zero.
✗ Incorrect
bartlett(5) returns [0; 0.5; 1; 0.5; 0]. Sum is 2.
🧠 Conceptual
advancedEffect of window length on frequency resolution
Which statement correctly describes how increasing the length of a window affects frequency resolution in signal processing?
Attempts:
2 left
💡 Hint
Think about how longer windows affect the sharpness of frequency components.
✗ Incorrect
Longer windows produce narrower main lobes in the frequency domain, improving frequency resolution.
❓ Predict Output
expertOutput of custom window function code
What is the output of this MATLAB code?
n = 6;
w = zeros(n,1);
for k = 1:n
w(k) = 0.5 - 0.5*cos(2*pi*(k-1)/(n-1));
end
w
MATLAB
n = 6; w = zeros(n,1); for k = 1:n w(k) = 0.5 - 0.5*cos(2*pi*(k-1)/(n-1)); end w
Attempts:
2 left
💡 Hint
This formula matches the Hann window definition for length 6.
✗ Incorrect
The formula computes the Hann window values for n=6, which are approximately [0; 0.3455; 0.9045; 0.9045; 0.3455; 0].
