How do I create a better data pulse train?
Show older comments
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 Comment
billyjthorton
on 7 Aug 2016
Answers (1)
Image Analyst
on 7 Aug 2016
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 Comments
billyjthorton
on 7 Aug 2016
Image Analyst
on 7 Aug 2016
Will xlim() and ylim() work for you?
billyjthorton
on 7 Aug 2016
Image Analyst
on 7 Aug 2016
Anytime after you call plot().
billyjthorton
on 7 Aug 2016
Edited: billyjthorton
on 7 Aug 2016
Image Analyst
on 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
on 7 Aug 2016
Image Analyst
on 7 Aug 2016
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;
Categories
Find more on AI for Signals in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!