% Plot the frequency domain response of a Raised Cosine (RC) filter
% Version: December 17, 2013
% Author Michel Barbeau
T=0.25; % symbol period
beta=0.5; % roll-off factor
f=-4:0.01:4; % range of frequencies
S=zeros(1,length(f));
for i=1:1:length(f)
    if abs(f(i))<[(1-beta)/(2*T)]
        S(i)=T;
    elseif (abs(f(i))>=[(1-beta)/(2*T)]) & (abs(f(i))<=[(1+beta)/(2*T)])
        S(i)=T/2*[1 + cos( (pi*T/beta)*(abs(f(i))-(1-beta)/(2*T)) )];
    end
end
% plot the fequency domain response
plot(f,S);
xlabel('Frequency (k Hz)');
ylabel('Gain');
ylim([0.0 0.26]);
grid on;

