filter_tap - compute the coefficients of FIR used in digital communication
pulse = filter_tap(typ,nb_coef,fe,param,gain)
- typ : integer. set the type of the impulse response
- 1 : Root Raised Cosine (param : alpha=roll-off)
- 2 : Raised Cosine (param : alpha=roll-off)
- 3 : Gauss (param : beta=BT)
- nb_coef : integer. length of impulse response in samples
- fe : integer. frequency sampling
- param : real. the parameter of the impulse response.
- for typ=1 and typ=2 : roll-off factor of the RC and RRC filter
- for typ=3 : BT factor of the gaussian filter
- gain : real. linear output gain of the impulse response
- pulse : the real vector of the impulse response
//filter_tap macro qui retourne les coefficients d'une
//réponse impulsionnelle pour filtrage RIF
//05-01-2005 Alan Layec -IRCOM Lab-
//
//typ = 1 : Root Raised Cosine (param : alpha=roll-off)
// = 2 : Raised Cosine (param : alpha=roll-off)
// = 3 : Gauss (param : beta=BT)
//nb_coef : desired lenght of impulse response
//fe : sampling frequency
//param : parameters of response (see typ description)
//gain : output gain
//
//ex :
//nb_coef=64
//Ne=12
//r=0.35
//gain=1
//[pulse]=filter_tap(1,64,Ne,r,gain)
function [pulse]=filter_tap(typ,nb_coef,fe,param,gain)
if typ<>1&typ<>2&typ<>3 then
message('Only 1,2 or 3 must be choosen for type of filtering');
pulse=[];
abort;
end
if typ==1 then
//RRC
r=param;
t_Ts=1/fe*(-nb_coef/2:nb_coef/2-1)+%eps;
pulse = gain*4*r/%pi*(cos((1+r)*%pi*t_Ts) + (sin((1-r)*%pi*t_Ts)./(4*r*t_Ts)))./(1-(4*r*t_Ts).^2);
elseif typ==2 then
//RC
r=param;
t_Ts=1/fe*(-nb_coef/2:nb_coef/2-1);
h1=cos(%pi*r*t_Ts)./(1-(4*r^2*t_Ts.^2)+(abs(r*t_Ts)==1/2))+(abs(r*t_Ts)==1/2)*%pi/4;
h2=(sin(%pi*t_Ts))./(%pi*t_Ts+(t_Ts==0))+(t_Ts==0);
pulse=gain*(h1.*h2);
elseif typ==3 then
//Gauss
b=param;
t_Ts=1/fe*(-nb_coef/2:nb_coef/2-1);
pulse=1/fe*gain*b*sqrt((2*%pi)/log(2))*exp(-2/log(2)*(b*%pi*t_Ts)^2);
end
//pulse=typ;
endfunction
IRCOM Group
Alan Layec