I know how to find the amplitude spectrum of a sine wave
and I know how to generate a Hanning window
but how do I use a Hanning window to plot the amplitude spectrum of a sine wave?
I've tried all kinds of variations on what I would imagine should work but it just doesn't happen.
Code:
t=(0:99)/100;
S=sin(2*pi*25*t);
Y=fft(S);
plot(abs(Y))
Code:
n=100;
whann=hanning(n);
[Px,f]=freqz(whann/sum(whann),1,512,2);
plot(f,20*log10(abs(Px)))
I've tried all kinds of variations on what I would imagine should work but it just doesn't happen.