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 Kommentar

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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 7 Aug. 2016

0 Stimmen

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 Kommentare

billyjthorton
billyjthorton am 7 Aug. 2016
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 am 7 Aug. 2016
Will xlim() and ylim() work for you?
billyjthorton
billyjthorton am 7 Aug. 2016
I'm not sure where to place those?
Image Analyst
Image Analyst am 7 Aug. 2016
Anytime after you call plot().
billyjthorton
billyjthorton am 7 Aug. 2016
Bearbeitet: billyjthorton am 7 Aug. 2016
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 am 7 Aug. 2016
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 am 7 Aug. 2016
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;

Melden Sie sich an, um zu kommentieren.

Kategorien

Produkte

Gefragt:

am 7 Aug. 2016

Kommentiert:

am 7 Aug. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by