Eye diagram: Redefining a variable?
Mostrar comentarios más antiguos
I'm doing a MATLAB exercise to generate eye diagrams of different digital waveforms for a digital comm. course. The program is written in the text book, I just need to understand this one command:
yrz = yrz(1:end-Tau+1);
The whole program:
%(pnrz.m)
%generating a rectangular pulse of width T
function pout=prect(T);
pout=ones(1,T);
end
%(prz.m)
% genrating a rectangular pulse of width T/2
function pout=prz(T);
pout=[zeros(1,T/4) ones(1,T/2) zeros(1,T/4)];
end
%(psine.m)
% generating a sinusoid pulse of width T
function pout=psine(T);
pout=sin(pi*[0:T-1]/T);
end
%(binary_eye.m)
% generate and plot eyediagrams
clear;clf;
data = sign(randn(1,400)); %Generate 400 random bits
Tau=64; %Define the symbol period
dataup=upsample(data, Tau); %Generate impulse train
yrz=conv(dataup,prz(Tau)); %Return to zero polar signal
yrz=yrz(1:end-Tau+1);
ynrz=conv(dataup,pnrz(Tau)); %Non-return to zero polar
ynrz=ynrz(1:end-Tau+1);
ysine=conv(dataup,psine(Tau)); %half sinusoid polar
ysine=ysine(1:end-Tau+1);
eye1=eyediagram(yrz,Tau,Tau,Tau/2);title('RZ eye-diagram');
eye2=eyediagram(ynrz,Tau,Tau,Tau/2);title('NRZ eye-diagram');
eye3=eyediagram(ysine,Tau,Tau,Tau/2);title('Half-sine eye-diagram');
1 comentario
Jan
el 1 de Jul. de 2013
Please follow the "? Help" link to learn how to format code in this forum. Thanks.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Sources and Sinks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!