Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How to make this bandpass filter?
Replies: 5   Last Post: Feb 1, 2010 12:33 PM

 Messages: [ Previous | Next ]
 Minimax Posts: 12 Registered: 1/23/09
Re: How to make this bandpass filter?
Posted: Feb 1, 2010 11:49 AM

"Wayne King" <wmkingty@gmail.com> wrote in message <hk433k\$akp\$1@fred.mathworks.com>...
> "Minimax " <aseid@mail.ru> wrote in message <hk40bh\$kgg\$1@fred.mathworks.com>...
> > "Wayne King" <wmkingty@gmail.com> wrote in message <hk3tui\$mf6\$1@fred.mathworks.com>...
> > > "Minimax " <aseid@mail.ru> wrote in message <hk3j5m\$j0k\$1@fred.mathworks.com>...
> > > > Good day!
> > > > I have the 3d matrix z500(latitude,longitude,time),
> > > > where
> > > > latitue=1:73
> > > > longitude=1:144
> > > > time=1:124 (here 31 days, because 4 timestep is 1 day)
> > > >
> > > > I need a bandpass filter that passes days from 1 to 5.
> > > >
> > > > How to make this bandpass filter?

> > > Hi, what makes you think you need a "bandpass filter" for this problem. Can you be more specific about what you're doing? To understand, you have a 73X144X124 matrix and you just want to extract the data corresponding to days 1 to 5? If that is the case and your data is Z, why can't you just do:
> > >
> > > NewData = Z(:,:,1:20);
> > >
> > > Wayne

> >
> > Thank you for your help!
> > Yes, i have a 73X144X124 matrix and i want to apply for my data a bandpass filter
> > like below, but someone said that this code was incorrect.
> > i need it for get the filtered field of Z with periods (1<=T<=5 days).
> >
> > [b,a] = butter(1,[ 1/(5*4) 1/(1*4) ],'stop');
> > y=filter(b,a,z500);

>
> OK, so if I understand your situation, you have a 3D matrix where time is along the 3rd dimension and you just want to bandpass filter the data along the time dimension.
>
> Since you are sampling at 4 samples/day. Your normalized frequencies are
>
> Freq =2*[1/5 1]/4;
> Assuming that you don't have any aliasing problems, i.e. that you don't have any oscillations in the data with periods less than 12 hours, you can do this:
>
> N = 5; % the order of the bandpass filter will be 2*N
> Freq =2*[1/5 1]/4; % Frequency vector for bandpass
> [B,A] = butter(N,Freq);
> fvtool(B,A) % allows you to visualize your filter's magnitude response
>
> You can then filter your matrix, assume it's Z, along the 3rd dimension with
>
> y = filter(B,A,Z,[],3);
>
> Hope that helps,
> Wayne

Thank you very much for your help!
And i suppose that full code will be

N = 5; % here N=2n+1, where n - the dimension of my series (lat*lon), am i right?
Freq =2*[1/5 1]/4;
[B,A] = butter(N,Freq);
y = filter(B,A,Z,[],3);
where Z==Z(:,:,:)

Am i right?

Date Subject Author
1/31/10 Minimax
1/31/10 Wayne King
1/31/10 Minimax
1/31/10 Wayne King
2/1/10 Minimax
2/1/10 Wayne King