How do I create a better data pulse train?

I have a question on creating a data pulse train for several signals. To start off, here is my code:
% (binary_eye.m)
% generage and plot eyediagrams
%
clear;clf;
data = sign(randn(1,400)); %Generate 400 random bits
Tau=64;
dataup = upsample(data, Tau); %Generate impulse train
yrz=conv(dataup,prz(Tau)); %Return to zero polar signal
yrz=yrz(1:end-Tau+1);
figure(1);
plot(yrz); title('YRZ data pulse train');
ynrz=conv(dataup,pnrz(Tau)); %Non-return to zero polar
ynrz=ynrz(1:end-Tau+1);
figure(2);
plot(ynrz); title('YNRZ data pulse train');
ysine=conv(dataup,psine(Tau)); %Half sinusoid polar
ysine=ysine(1:end-Tau+1);
figure(3);
plot(ysine); title('YSINE data pulse train');
Td=4; %Truncating raised cosine to 4 periods
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
figure(4);
plot(yrcos); title('YRCOS data 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');
As you can see in my comments and the graph titles, I am trying to plot the data pulse train (the time series plot of the signals like yrz and ynrz) at several places. However, when I graph it, the graph turns out quite convoluted with all the pulses. What can I do to sort of zoom in on a portion to create a nice looking data pulse train for these signals? Thanks so much for your help in advanced!

댓글 수: 1

You might also need these library functions to compile the code:
% (pnrz.m)
% generating a rectangular pulse of width T
% usage function pout=pnrz(T);
function pout=prect(T);
pout=ones(1,T);
end
% (prz.m)
% generating a rectangular pulse of wisth T/2
% usage function pout=prz(T);
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
% (prcos.m)
% Usage y=prcos(rollfac,length, T)
function y=prcos(rollfac,length, T)
% rollfac = 0 to 1 is the rolloff factor
% length is the onesided pulse length in the number of Trcos
% length = 2T+1
% T is the oversampling rate
y=rcosfir(rollfac, length, T, 1, 'normal');
end

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2016년 8월 7일

0 개 추천

I get this error:
Undefined function or variable 'prz'.
Error in test3 (line 8)
yrz=conv(dataup,prz(Tau)); %Return to zero polar signal
So anyway, one thing I can suggest is to call xlim() and ylim() to home in on the region you want to view in higher detail.

댓글 수: 8

billyjthorton
billyjthorton 2016년 8월 7일
Above in the comments to my question I added the library functions needed to compile the code. Let me know if you have any further issues!
Image Analyst
Image Analyst 2016년 8월 7일
Will xlim() and ylim() work for you?
billyjthorton
billyjthorton 2016년 8월 7일
I'm not sure where to place those?
Image Analyst
Image Analyst 2016년 8월 7일
Anytime after you call plot().
billyjthorton
billyjthorton 2016년 8월 7일
편집: billyjthorton 2016년 8월 7일
Doing something like
plot(yrz); title('YRZ data pulse train');
xlim();ylim();
Doesn't seem to adjust the graph any? Do you have any other suggestions?
Image Analyst
Image Analyst 2016년 8월 7일
xlim() by itself just returns the existing limits of the x axis. To SET them, you have to pass in some values. Did you look at the help for it?
billyjthorton
billyjthorton 2016년 8월 7일
Okay, that seemed to work. Speaking of set, how does the set() function fit into using xlim(); and ylim();
The set() function is the old fashioned way. Some properties didn't have a special function like xlim() to get them and you had to do it manually, like
set(gca, 'XTick', 0:20:100);
Now however, you use OOP syntax
ax = gca;
ax.XTick = 0:20:100;

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 AI for Signals에 대해 자세히 알아보기

제품

질문:

2016년 8월 7일

댓글:

2016년 8월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by