% plot_RaisedCos - plot a raised cosine function and its discrete-time
% equivalent

%% parameters
fsT  = 8;   % fsT for discrete-time equivalent system
fsTp = 100; % fsT for plotting

%% discrete-time equivalent
% closed form expression for
% h[n]=sqrt(2/3)*(1-cos(2*pi*(n+1/2)/fsT)*sinc(pi/fsT)/(pi/fsT))
tts = ( (0:fsT-1) + 1/2 )/fsT;
hh = sqrt(2/3) * ( 1 - cos(2*pi*tts)*sin(pi/fsT)/(pi/fsT));

%% plot continuous time and discrete-time pulse
tt = ( 0 : fsTp-1 ) / fsTp;
plot( tt, RaisedCos( fsTp ) , tts, hh, 'o');
grid
axis( [0 1 0 2])
xlabel('Time/T')

%% Store name of script for automated figure generation
ScriptName = mfilename;