DSPRelated.com
Forums

Hamming window

Started by rajgerman February 19, 2006
Search amazon.com for ["digital signal processing" matlab] and see the books 
that pop out.
Ingle, Proakis
Mitra
Stearns
all seem to get high marks.

I wouldn't be surprised if you can't find some matlab code for dsp on the 
web.
So, there would be examples.

matlab is a language so you need to learn the language separately I should 
think - at least that would be my approach.  Then you can use tricks learned 
from real code.
A good book on matlab might be a good idea because the DSP books probably 
won't help much in learning how to construct things.

But, hey, it's an iterative process and we've all used somebody else's code 
to avoid learning a whole lot of new stuff at once haven't we?

Fred 


Hey

This is my modified code. My filtered signal looks like a V shape, where
the centre is sloped down. I don't think that looks right, why is that??

figure(1)
t = (0:2/(88200-1):2);         
plot(t,y)
title('Brain Signal (2 sec)')
xlabel('Time(t)')
ylabel('Voltage(v)')

Y = y.*hamming(length(y)); 

figure(2)                     
plot(t,Y)
title('Hamming window applied to signal')
xlabel('Time(t)')
ylabel('Voltage(v)')


figure(3)
X = fft(Y);
plot(X)
title('FFTed signal')
xlabel('logf')
ylabel('log|Y|')

Z = X.*conj(X);                 
figure(4)
plot(Z)
title('Hamming window + Conjugate applied')
xlabel('logf')
ylabel('log|Y|')


figure(5)
loglog(Z)                      
title('loglog plot')

figure(6)
semilogx(Z)                    
title('semilogx plot')

figure(7)
semilogy(Z)                    
title('semilogy plot')

A = fftshift(Z);               

figure(8)
semilogy(A)                    
title('Simplified signal in frequency domain')     
                               


figure(9)
f = (-fs/2:1/2:fs/2-1/2)/1000;   
semilogy(f,A)
title('Simplified signal in frequency domain')
xlabel('Frequency (KHz)')

figure(10)
f2 = (0+1/2:1/2:fs/2)/1000;               
A_p = A(end/2+1:end);
semilogy(f2,A_p)
title('Positive side of A')
xlabel('Frequency (KHz)')

figure(11)
f3 = (-fs/2:1/2:0-1/2)/1000;               
A_n = A(1:end/2);
semilogy(f3,A_n)
title('Negative side of A')
xlabel('Frequency (KHz)')


figure(12)
V = zeros(1,88200);                         
f = (-44100/2:1/2:44100/2-1/2)/1000;
S = 500/0.5;                               
P = 44100-S:44100+S;
V(1,P) = 1;
plot(f,V)
title('Filter')
xlabel('Frequency (KHz)')

F_filt=A(P);                                
f_filt=f(P);

figure(13)                             
semilogy(f_filt,F_filt)
title('Filtered data')
xlabel('Frequency (KHz)')

figure(14)
I = ifft(fftshift(F_filt));             
plot(t(P),abs(I))
title('Filtered signal in time domain')
xlabel('Time(t)')