function pulse=srrc(fs,Rs,Nfilter,r) % PULSE=SRRC(FS,RS,NFILTER,R) % PULSE is the impulse response of a square root raised cosine filter. FS is % the sampling frequency, RS is the symbol rate and NFILTER is the duration % of the impulse response in symbol times. R is the rolloff factor. % % Daniel Aronsson, 2005-02-10 if abs(fs/Rs - round(fs/Rs)) > 1e-6 error('fs/R must be an integer.'); end if Nfilter ~= round(Nfilter) error('Nfilter must be an integer'); end if r<0 | r>1 error('R must obey 0 -(1+r)/2/T & f <= -(1-r)/2/T) + ... T .*(f > -(1-r)/2/T & f <= (1-r)/2/T) + ... T/2*(1+cos(pi*T/r*(f-(1-r)/2/T))) .*(f > (1-r)/2/T & f <= (1+r)/2/T) + ... 0 .*(f > (1+r)/2/T); X=fs*X; % Want the peak to be at 1 X=sqrt(X); pulse=real(fftshift(ifft(X))); % This gives (almost) the same result as % rcosfir(r, Nfilter/2, fs/Rs, Rs, 'sqrt') (remove the last element)