Eye diagram: Redefining a variable?

조회 수: 7 (최근 30일)
Mohamed Ali
Mohamed Ali 2013년 7월 1일
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