pulse = filter_tap(typ,nb_coef,fe,param,gain)
Add here a paragraph of the function description. Other paragraph can be added
Add here a paragraph of the function description
Add here scilab instructions and comments
//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