FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6359 Discussions

fir filter design - newbie

Altera_Forum
Honored Contributor II
1,196 Views

dear sirs, 

 

as i am second year engineering student, i want to design an fir filter for y filter and cbcr filter , i dont know how to do it, my instructor only gave me a pdf , design in matlab or vhdl or verilog  

 

 

thanks  

 

baba
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
395 Views

Hi, 

 

Since the frequency requirements are prescribed in your pdf then you need to go to matlab and then there are several ways to get your filter coefficients. Once you get them, you need to implement the filter in HDL. 

Alternatively, use a short cut e.g Altera fir compiler to generate the HDL code directly from your frequency requirements. 

 

In Matlab, a convenient way is to use the FDAtool GUI by typing (fdatool) then play with it and you will learn. 

 

I hope this helps.
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

hi thanks for reply, actually to be frank , i dont know how to interpret it correctly, i did it in matlab, but the image is not clear, for the filter i designed, imag is bleeding in high frequecny. that is why i upload the specificaton here. please help  

 

regards, 

 

baba
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

Hi again, 

 

Your frequency is prescribed in terms of attenuation, however Matlab and most filter designers use gain values so you must convert the attenuation values to gain values by negating each value e.g 0dB,10dB,50dB becomes 0dB,-10,-50dB gain then enter them in Matlab. 

 

You should also use an "adequate" number of taps. 

 

You may also see help about (fir2) or (remez) or (firls) and use these functions instead of fdtool as you can control each frequency point. 

 

hope this helps
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

dear kaz, 

 

thanks for your response, please, i dont have enough idea about this thing, i know only theory little of dsp, and i dont have much idea about matlab. since my lab access time is very limited to us, due to vacation. please could you tell , what is the if 13.5 mhz is the sampling frequency, and pass band and stop band, and my instructor told me to use 7 tap filter, i tried with fdatool, and take the coeffs. and put that coeff in vhdl. architecture and all fine. only this filter coeff, is a headache for me. because some time the image is so bleeding,  

 

 

thanks and regards, 

 

baba
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

Hi baba, 

 

One issue which causes headache to everybody is that "Matlab people" use Nyquist frequency as = 1. They never bothered to modify this anomaly despite their billions of profits. Everybody uses Fs = 1. (Nyquist is the point .5Fs of any system) 

 

I mean in digital sampling systems, you don't need to bother about absolute frequency but just assume Fs=1 then any frequency point is a fraction relative to this 1 e.g. .1,.2,.3,...etc. Once you implement your real Fs say of 13.5MHz then the points relate accordingly e.g. (.1) becomes 1.35MHz and so on. 

 

So make sure that you also double each point of your pdf values before entring them in Matlab(e.g. the point .4Fs => .8 in Matlab 

 

As to the issue of group delay in cascaded filters(as written in your pdf), as long as you use symmetrical FIR then don't worry about it. A 7 tap symmetrical fir gives a constant delay of (7-1)/2 i.e. 3 sample periods. 

 

I have the impression that 7 taps is too little but it could be just an exercise. 

 

Regards.
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

dear kaz, 

 

sorry for delay reply, yesterday my town power is down, in this design,  

if , FS=13.5, then pass band is 5.4(.4*13.5)Mhz, then stop band is .5(13.5)Mhz, then what the other one .60*13.5(8.1) Mhz, and .73*13.5(9.855)Mhz. i am now totally confussed, plese help me. 

 

regards 

 

 

baba
0 Kudos
Altera_Forum
Honored Contributor II
395 Views

Hi Baba, 

 

You don't need to think of it in these fixed terms. A filter response may be defined as two sections(passband,stopband) or as three sections(adding transitionband) or better it is defined at specific points on the frequency axis. 

 

Judging by your graph, your frequency fits the latter. Though I can say that the passband is 0~.4 

transitionband is .4~.73 

stopband is .73~1 

The section .4~.5 is undefined(don't care area) 

section .5~.6 is within transitionband. 

 

What passed my notice,however, is that the frequency response is described beyond .5Fs(beyond Nyquist). This means you must upsample the input signal by 2 at least so that the Nyquist point becomes .25Fs(i.e .5 for Matlab). This is a bit an advanced subject for a beginner like yourself.  

 

To explain this better: in any real filter, you can only control the section 0~.5Fs(the section .5Fs~1 will be mirror image of section 0~.5Fs unless your filter is complex fir with real and imaginary components). 

 

I am myself now confused as how on earth such a filter is supposed to be designed by a beginner. Though, in princile,it is quite basic for a filter designer. 

 

Try and read about interpolating filters. For example, the root raised cosine filter is similar conceptually(it has a well defined transition band and must upsample its input by 2 minimum). 

Regards 

Kaz
0 Kudos
Reply