Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: FIR Filter
Posted:
Sep 20, 2009 1:25 PM


"alfredo " <luka_ice@hotmail.com> wrote in message <h95lpb$k7g$1@fred.mathworks.com>... > "Wayne King" <wmkingty@gmail.com> wrote in message <h92lvl$866$1@fred.mathworks.com>... > > "alfredo " <luka_ice@hotmail.com> wrote in message <h92ku4$2o2$1@fred.mathworks.com>... > > > Rune Allnor <allnor@tele.ntnu.no> wrote in message <6d6346f2e0934f73a99b156b9b675eb0@y42g2000yqb.googlegroups.com>... > > > > On 13 Sep, 12:10, "alfredo " <luka_...@hotmail.com> wrote: > > > > > I have some problems with FIR filter,someone can help me? > > > > > > > > > > I write my pseudo code: > > > > > > > > > > clear all; > > > > > Asim=[17, 18]; ?%Definisce le ampiezze > > > > > Tsim=[22.5, 33.48]; ?%Definisce i periodi > > > > > fase=[1.1, 2.2]; ?%Definisce le fasi > > > > > p=1:2048; > > > > > value=0; ?%Oscilla attorno la linea dello zero se value=0 > > > > > Coseno1=0; > > > > > Coseno2=0; > > > > > Coseno1=Coseno1+Asim(1)*cos(2*pi*1/Tsim(1)*p+fase(1))'; > > > > > Coseno2=Coseno2+Asim(2)*cos(2*pi*1/Tsim(2)*p+fase(2))'; > > > > > > > > > > serie12=Coseno1+Coseno2; > > > > > step =0.01; > > > > > > > > > > serie= serie12; > > > > > step=0.01; > > > > > Tmin=8; > > > > > Tmax=120; > > > > > A=length(serie); > > > > > > > > > > Y=fourier(serie',Tmax,Tmin,step); ? ? ? ? ? ?%fourier trasform > > > > > > > > > > Ok , now how can I implement a high pass filter FIR, for cut off ?the frequency 1/ 33.48 ? > > > > > > > > What has all this to do with designing filters? > > > > > > > > Rune > > > > > > > > > > > > I try with this: > > > > > > d = fdesign.highpass('Fst,Fp,Ast,Ap',0.03,0.043,60,0.5,10000) ; > > > Hd = design(d,'FIR'); > > > smoothed_data = filter(Hd,Y); > > > > > > but I have some problems, I thik because I have R2007b version... > > > > Hi Alfredo, the filter specification objects such as fdesign.highpass were introduced in the Signal Processing Toolbox in R2009a, they are part of the Filter Design Toolbox prior to that. > > In R2007b, you have a number of nonobjectoriented FIR design routines available in the Signal Processing Toolbox. Take a look at firpm() for an equiripple design, fir1() for a window method FIR design, fir2() uses frequency sampling, and firls() for leastsquares error minimization as examples. Post back if you have difficulty, I'm not sure you really want the filter design you have above in fdesign.highpass (or I would have given you a comparable example) because you are basically just passing everthing. Your stopband frequency is only 0.03 Hz? (you have a sampling frequency of 10 kHz specified), your passband starts at 0.043 Hz... > > > > Hope that helps, > > wayne > > thank you for this information, I try immediately these function but I can select if I want a high pass or a lowpass filter? > the freq 0,03 and 0.043 ara the inverse of the period of cicles 22.5 and 33.48 ( I want to cutoff the 33.48 period cycle ), I'm not sure of f sampling becouse I work with time series . > > Alfredo
Hi Alfredo, I am not sure what you mean by "period cycle" so I'll just give you an example of firpm() and hopefully you can make it meaningful.
firpm() works on a normalized frequency scale [0,1] with 1 being (1)pi radians per sample.
Let's assume you want a highpass filter for data sampled at 10 kHz where you pass everything above 2 kHz and cut everything off below 1.8 kHz.
In this case we have the passband frequency: (2*2000)/10000=0.4 the stopband frequency is (2*1800)/10000=0.36
So a simple call to design an equiripple FIR filter is:
h = firpm(150,[0 0.36 0.4 1],[0 0 1 1]); % The impulse response of the filter is returned in h % you can view the filter magnitude response fvtool(h)
Hope that helps, wayne



