
T=1;
step=0.05;
Nsymbols=50;

symbols=randint(1,Nsymbols,4);
symbols=2*symbols-3;	% 4-PAM

ts=T/2:step:Nsymbols*T+T/2;
for it=1:length(ts)
	t=ts(it);
        y(it)=0;
        for isym=1:length(symbols)
            y(it)= y(it) + symbols(isym)*raised_cosine(t-(isym-1)*T);
        end;
end

figure(1)
plot(ts, y)
xlabel('t')
ylabel('y(t)');
title('Received signal y(t)');
set(gca,'xlim',[0, 20]);

figure(2)
hold on
ty=T/2:step:T+T/2-step;
index=1:length(ty);
for isym=1:length(symbols)-3
    sup_y=y(index+(isym-1)*length(index));
    plot(ty,sup_y); hold on
end
hold off
xlabel('one symbol interval');
ylabel('Eye Diagram')
set(gca,'xlim',[0.5, 1.5-step]);
