Eye diagram: Redefining a variable?
조회 수: 7 (최근 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
채택된 답변
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 Center 및 File Exchange에서 Sources and Sinks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!