Eye diagram: Redefining a variable?

14 次查看(过去 30 天)
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 个评论
Jan
Jan 2013-7-1
Please follow the "? Help" link to learn how to format code in this forum. Thanks.

请先登录,再进行评论。

采纳的回答

Pourya Alinezhad
Pourya Alinezhad 2013-7-1
the code dose not work on my pc. because prz and psin ,... functions are not provided with the code. following code: yrz = yrz(1:end-Tau+1); removes one symbol length data from yrz's end.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sources and Sinks 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by