Week 14 Matlab project, ELEN420/Prof. Kraimeche In this assignment, we use Matla
ID: 3865814 • Letter: W
Question
Week 14 Matlab project, ELEN420/Prof. Kraimeche
In this assignment, we use Matlab to plot basic digital signal pulses: NRZ polar, RZ polar, half-sinusoid polar, and raised-cosine, and generate eye diagrams. The Matlab programs to be used are given on page 437 of the textbook. Run the Matlab programs to generate and plot:
NRZ, RZ, half-sinusoid, and raised cosine pulses
The eye diagrams for the 4 types of pulses above
The original Matlab programs are reproduced below:
% (pnrz.m)
% generating a rectangular pulse of width T
% Usage function pout=pnrz(T);
function pout=prect(T);
% ----------------------------------------------------
% (prz.m)
% generating a rectangular pulse of width T/2
% Usage function pout=prz(T);
function pout=prz(T);
pout=[zeros(1,T/4) ones(1,T/2) zeros(1,T/4)];
% -------------------------------------------------------
% (psine.m)
% generating a sinusoid pulse of width T
function pout=psine(T);
% --------------------------------------------------------
% (prcos.m)
function y=prcos(rollfac,length, T)
% rollfac = 0 to 1 is the rolloff factor
% length is the onesided pulse length in the number of T
% length = 2T+1;
% T is the oversampling rate
y=rcosfir(rollfac, length, T,1, ’normal’);
% -------------------------------------------------------------
% (binary_eye.m)
% generate and plot eyediagrams
data = sign(randn(1,400));% Generate 400 random bits
dataup=upsample(data, Tau); % Generate impulse train
ynrz=conv(dataup,pnrz(Tau)); % Non-return to zero polar
yrcos=conv(dataup,prcos(0.5,Td,Tau)); % rolloff factor = 0.5
yrcos=yrcos(2*Td*Tau:end-2*Td*Tau+1); % generating RC pulse train
eye1=eyediagram(yrz,2*Tau,Tau,Tau/2);title(’RZ eye-diagram’);
eye2=eyediagram(ynrz,2*Tau,Tau,Tau/2);title(’NRZ eye-diagram’);
eye3=eyediagram(ysine,2*Tau,Tau,Tau/2);title(’Half-sine eye-diagram’);
eye4=eyediagram(yrcos,2*Tau,Tau); title(’Raised-cosine eye-diagram’);
Program codes for Matlab and Include Plots