function [rcft,omega] = rcspectrum(alpha, omegastep)

%Raised Cosine Pulse frequency spectrum 
%function [rcft,omega] = rcspectrum(alpha, omegastep)
%   returns a vector rcft whose elements are the frequency spectrum of the
%   raised cosine pulse at frequencies
%   omega = -2*pi : omegastep : 2*pi
%   alpha - rolloff factor in [0,1]
%   EE 120 - University of California, Berkeley - Fall 2005


omega = [-2*pi:omegastep:2*pi];
rcft = zeros(size(omega));

for i = 1:length(omega)
    if (abs(omega(i)) < (1-alpha)*pi)
        rcft(i) = 1;
    elseif (abs(omega(i)) >= (1+alpha)*pi)
        rcft(i) = 0;
    else
        rcft(i) = .5*(1 - sin((pi*(abs(omega(i)) - pi))/(2*alpha*pi)));
    end
end

