Thread Subject: Time serie filtering with window technique

Subject: Time serie filtering with window technique

From: Dias Papas

Date: 6 Nov, 2009 19:17:04

Message: 1 of 1

Hi,
I want to filter a time series with a FIR window technique and I programmed the below code.
It works but I am not sure if it works properly.
Question: I use the filter command in the space domain with the coefficient h.
So i do the filtering in the space domain. Is there any way to do the filtering in the frequency domain with H?
Also can you tell me if it works properly?

The code:

wp = 0.2*pi;
ws = 0.3*pi;
tr_width = ws - wp
M = ceil(6.6*pi/tr_width) + 1
wc = (ws+wp)/2; %cut off frequency
hd = ideal_lp(wc,M); % ideal impulse response
w_ham = (hamming(M))'; % window
h = hd .* w_ham; % impulse response
fr = 0:0.001:pi; %step
H = freqz(h,1,fr); % filter frequency response
x = randn(100,1); % data: discrete time serie
X = freqz(x,1,fr); % data frequency response
y = filter(h,1,x); % output
Y = freqz(y,1,fr); % output data frequency response
% Plot
figure (1)
subplot(121)
plot(fr,abs(H))
title('Frequency response H'); xlabel('frequency in radians')
subplot(122)
semilogy(fr,abs(H))
title('Frequency response H'); xlabel('frequency in radians')
figure(2)
plot(x)
title('Data in space domain')
figure (3)
plot(fr,abs(X))
title('Data in frequency domain')
figure (4)
plot(fr,abs(Y))
title('Output in frequency domain')
figure (5)
plot(y)
title('Output in space domain')
figure (6)
plot(fr,abs(YY))
title('Output in frequency domain')
figure (7)
plot(yy)
title('Output in space domain')

Thanks very much
Dias

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
filter Dias Papas 6 Nov, 2009 14:19:08
fir Dias Papas 6 Nov, 2009 14:19:08
window technique Dias Papas 6 Nov, 2009 14:19:08
rssFeed for this Thread

Contact us at files@mathworks.com