DSP Lab Manual
DSP Lab Manual
This example shows how to use the comm.EyeDiagram System object to perform eye diagram
measurements on simulated signals.
% Add AWGN
received = channel(message);
% Update the eye diagram object with the noisy NRZ signal
eyeObj(received);
eyeObj =
Trace configuration
SampleRate: 10000
SamplesPerSymbol: 100
SampleOffset: 40
SymbolsPerTrace: 2
Display configuration
DisplayMode: '2D color histogram'
EnableMeasurements: 0
ShowImaginaryEye: 0
YLimits: [-1.5000 1.5000]
ShowGrid: 1
Position: [320 282 640 460]
% Obtain PDF of random jitter generated by the combined jitter object. Set
% random jitter standard deviation to 1% of symbol time.
jitterSrc = commsrc.combinedjitter('SamplingFrequency', Fs, ...
'RandomJitter', 'on', 'RandomStd', 0.01/Rs);
jitter = generate(jitterSrc, 1e6);
rjPdf = histc(jitter, histEdges);
rjPdf = rjPdf / sum(rjPdf);
subplot(221);
plot(histEdges*1e3,rjPdf);
grid on;
title('Random Jitter');
xlabel('Time (ms)');
ylabel('PDF');
We can use the same jitter object in the pattern generator to inject jitter to the output signal. The following
code generates a signal that is impaired not only by AWGN but also by random jitter. This example uses
the same message data as in the previous case and compares the two signals. Note that the effect of
jitter on the signal is not clear in this time domain figure.
close(hFigPdf);
hide(eyeObj);
% Plot the jittered noisy NRZ signal with the noisy signal
t = 0:1/Fs:15/Rs-1/Fs;
idx = round(t*Fs+1);
figure(hFig);
hold on;
plot(t, received(idx), 'r');
title('Noisy and Jittered NRZ signal');
xlabel('Time (sec)');
ylabel('Amplitude');
grid on;
The effect of jitter is better illustrated by the eye diagram of the signal. The next two eye diagram figures
illustrate the impact of jitter. The width of the jittered signal at the zero amplitude level is considerably
larger than the width of the non-jittered signal as a result of the added random jitter. Note that even
though this example focuses on real signals, the eye diagram object can also display complex signals if
the ShowImaginaryEye property is set to true.
close(hFig)
% Run simulation
frameLen = 1000;
numFrames = 20;
lastSymbol = 0;
lastJitter = 0;
release(channel);
% Generate jittered signal
message = generate(src, frameLen*numFrames);
% Add ISI and noise
messageISI = transmitFilter(message);
received = channel(messageISI);
for k = 1:800
% Update the eye diagram object with the signal
eyeObjJitter( received( 1+(k-1)*10*2*sps : k*10*2*sps ) );
end
Comparing Measurements
We can use the measurement exporting capability of comm.EyeDiagram to compare measurements
obtained under different configurations. The next example examines the effect of random jitter on an NRZ
system with a 10 Gsps symbol rate. The deterministic jitter is set to 2 ns. The standard deviation of the
random jitter is increased from 300 ps to 500 ps, in 100 ps steps. The NRZ signal is passed through an
AWGN channel with 40 dB SNR. Note that AWGN will increase the random jitter since the rise and fall
times are non-zero.
Fs = 10e9;
Rs = 100e6;
sps = Fs/Rs;
Trise = 2e-9;
Tfall = 2e-9;
% Main loop
for randStd = stdVec
% Set the random jitter standard deviation and reset the eye diagram
% object
srcObj.Jitter.RandomStd = randStd;
hide(eyeObj);
reset(eyeObj);
release(eyeObj);
% Update the eye diagram object with the jittered and noisy source
x = generate(srcObj, frameLen*numFrames);
r = awgn(x, 40);
eyeObj(r);
meas(cnt) = measurements(eyeObj);
% Adjust the eye center to the middle of the time axis
timeOffsetSamps = 2*eyeObj.SamplesPerSymbol - Fs*meas(cnt).EyeDelay;
eyeObj.SampleOffset = round(timeOffsetSamps);
cnt = cnt+1;
end
hide(eyeObj);
hide(eyeObjJitter);
The following figure shows the measurement results for Horizontal Opening, Random Jitter, and
Deterministic Jitter. Since Random Jitter is measured for a bit error rate of 1e-12 (see the BER Threshold
property), the expected value of random jitter is about 14 times the standard deviation of the jitter
samples. For example, for a standard deviation of 300 ps, the random jitter at BER = 1e-12 is 4.2 ns.
hFig = figure;
plot(300:50:500, [meas.HorizontalOpening], 'b-*');
hold on;
plot(300:50:500, [meas.RandomJitter], 'r-*');
hold on;
plot(300:50:500, [meas.DeterministicJitter], 'g-*');
legend('Horizontal opening', 'Random jitter', 'Deterministic jitter', 'Location',
'northwest');
title('Measurement comparison for noisy NRZ signal');
xlabel('Standard deviation of random jitter (ps)');
ylabel('Time (s)');
grid on;
The horizontal and vertical openings can also be compared for different BER Threshold values using the
available bathtub curve displays.
eyeObj.ShowBathtub = 'Horizontal';
eyeObj.BathtubBER = [0.5 10.^-(1:3:13)];
show(eyeObj);