function [srrc]=SRRC(sym_spread,beta,P,t_offset);

% [srrc]=SRRC(sym_spread,beta,P,t_offset);
%
% This function generates a Square-root Raise Cosine Pulse with
% 'sym_spread' being half the length of srrc pulse in symbol durations. 
% 'beta' is the rolloff factor and 'P' is the oversampling factor. 
% 't_offset' is the offset of the pulse shaping function, a negative delay
%  as a multiple of the timing period T.

if (nargin==3),
t_offset=0;
end;

k=-sym_spread*P+1e-8+P*t_offset:sym_spread*P+1e-8+P*t_offset; % sampling indices as a multiple of T/P

if (beta==0)
beta=1e-8;
end;

srrc=4*beta/sqrt(P)*(cos((1+beta)*pi*k/P)+sin((1-beta)*pi*k/P)./(4*beta*k/P))./(pi*(1-16*(beta*k/P).^2));




