function slide=scattereyedemo
% Demonstration of eye diagram and scatter plot functions
%
%   SCATTEREYEDEMO is a slideshow demonstration of the new communications
%   toolbox functions, EYEDIAGRAM and SCATTERPLOT.  The first part of the
%   demonstration shows how to use these functions.  The second part
%   demonstrates the typical use of these functions in analysing communication
%   systems.  The final part  of the demonstration is an animation of the eye
%   diagram and scatter plot  that visualizes the impact of timing errors in a
%   communication system.

%   Copyright 1996-2000 The MathWorks, Inc.
%   $Revision: 1.7 $ $Date: 2000/09/08 23:01:02 $

if nargout<1,
  playshow scattereyedemo
else
  %========== Slide 1 ==========

  slide(1).code={
   'if (ichange < 0 & size(slideData.param,2) > 1)',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   '   if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'end',
   'oldIdx = get(slideData.resethandle,''UserData'');',
   'if ~isempty(oldIdx)',
   '    if (ichange == 0 & oldIdx > 1)',
   '       SlideShowVars=slideData.param(oldIdx).vars;',
   '       for SlideShown=1:size(SlideShowVars,1)',
   '          eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '       end',
   '       if exist(''h''); if ~isempty(h); if ishandle(h);close(h);end;end;end;',
   '       if exist(''h1''); if ~isempty(h1); if ishandle(h1);close(h1);end;end;end;',
   '       if exist(''h2''); if ~isempty(h2); if ishandle(h2);close(h2);end;end;end;',
   '       if exist(''h3''); if ~isempty(h3); if ishandle(h3);close(h3);end;end;end;',
   '    end',
   'end',
   'h = [];h1 = [];h2 = [];h3 = [];',
   'set(0,''ShowHiddenHandles'',''on'');',
   'fig = gcf;',
   'sp = get(fig,''position'');',
   'ss = get(0,''ScreenSize'');',
   'fp1 = [ss(3)*.011  ss(4)*.9-sp(4) sp(3)*1.25 sp(4)*1.1];',
   'if ichange == 0  & size(slideData.param,2) == 1; set(gcf,''position'',fp1); end;',
   'set(fig,''CloseRequestFcn'',''playshow #reset; closereq'')',
   'set(0,''ShowHiddenHandles'',''off'');',
   'N = 16; Fd = 1; Fs = N * Fd; Delay = 3; Symb = 60;offset=0;M = 16;',
   'msg_orig = randsrc(Symb,1,[0:M-1],54321);',
   'msg_tx = modmap(msg_orig,Fd,Fd,''qask'',M);',
   'x = complex(msg_tx(:,1),msg_tx(:,2));',
   '[y, t] = rcosflt(x, Fd, Fs);   plot(t, real(y));',
   ''};
  slide(1).text={
   'Plotting a modulated, filtered signal using PLOT does not display the characteristics of the modulation as clearly as the eye diagram and scatter plot.  The eye diagram overlays many short segments, called traces, to reveal the signal characteristics.  The scatter plot samples the signal at the symbol time and displays it in signal space. Press START to see an eye diagram of the data in the plot above. The sampling rate of 16 highlights the plotting functions''s capability. ',
   '',
   'N = 16; Fd = 1; Fs = N * Fd; Delay = 3; Symb = 60; offset=0; M = 16;',
   'msg_orig = randsrc(Symb,1,[0:M-1],4321);',
   'msg_tx = modmap(msg_orig,Fd,Fd,''qask'',M);',
   'x = complex(msg_tx(:,1),msg_tx(:,2));',
   '[y, t] = rcosflt(x, Fd, Fs);   plot(t, real(y));',
   ''};

  %========== Slide 2 ==========

  slide(2).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'h = eyediagram(y, N);',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(2).text={
   'EYEDIAGRAM is used to plot multiple traces of a modulated, filtered signal to demonstrate the shape of the modulation.  There is one plot for the in-phase component and another for the quadrature component.',
   '',
   'h = eyediagram(y, N);',
   ''};
  %========== Slide 3 ==========

  slide(3).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'yReal = real(y);',
   'h = eyediagram(yReal, N);',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(3).text={
   'EYEDIAGRAM can also be used to plot a real signal. yReal is the real or in-phase component of y.  EYEDIAGRAM senses that the signal is real and only creates one pair of axes.',
   '',
   'close(h);',
   'yReal = real(y);',
   'h = eyediagram(yReal, N);',
   ''};

  %========== Slide 4 ==========

  slide(4).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'yy = y(1+Delay*N:end-Delay*(N+2));',
   'h = eyediagram(yy, N);',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(4).text={
   'EYEDIAGRAM in the previous slides plotted all of y.  However, we are not interested in plotting the tails of y, which contain the early and late partial responses of the raised cosine filter. This slide demonstrates the eye diagram of yy, which does not include the tails of y.  Now the characteristics of the modulation are evident.  The in-phase and quadrature phase components of the 16-ary QAM each take on 4 distinct levels at the center of the eye plot and smoothly transition between levels.',
   '',
   'close(h);h = [];'
   'yy = y(1+Delay*N:end-Delay*(N+2));',
   'h = eyediagram(yy, N);'
   ''};

  %========== Slide 5 ==========

  slide(5).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'NumSym = 2;',
   'h = eyediagram(yy, N*NumSym, NumSym);',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   '' };
  slide(5).text={
   'EYEDIAGRAM can also plot multiple symbols in a trace.  The figure shows EYEDIAGRAM plotting two symbols per trace. ',
   '',
   'close(h)'
   'NumSym = 2;',
   'h = eyediagram(yy, N*NumSym, NumSym);',
   ''};

  %========== Slide 6 ==========

  slide(6).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'h = eyediagram(yy, N, 1, N/2);',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(6).text={
   'You may adjust the eye diagram so the open part of the eye is not at the center of the axes. This slide shows how EYEDIAGRAM can be called to plot the closed part of the eye in the center of the axes.',
   '',
   'close(h);h = [];'
   'h = eyediagram(yy, N, 1, N/2);',
   ''};

  %========== Slide 7 ==========

  slide(7).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'h = scatterplot(yy, N); ',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(7).text={
   'SCATTERPLOT generates a scatter plot, which is a plot of the in-phase versus quadrature components of the signal, decimated by a factor that is usually set to the number of samples per symbol, N. The resulting plot shows the received signal sampled at the symbol rate.  When the channel is noiseless and distortionless, the symbols are identical to the information symbols at the transmitter.',
   '',
   'close(h);h = [];'
   'h = scatterplot(yy, N); ',
   ''};

  %========== Slide 8 ==========

  slide(8).code={
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'plot(t, real(y));',
   'h = scatterplot(yy, 1, 0, ''c-'');',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'hold on;',
   'h = scatterplot(yy, N, 0, ''b.'', h);',
   'hold off;',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   '' };
  slide(8).text={
   'SCATTERPLOT is executed twice to generate this plot. The cyan line represent the in-phase versus the quadrature component of the received signal trajectory in signal space.  The blue dots represent the signal at the symbol sampling times.  This plot demonstrates that, even though the signal moves about in signal space, its value equals the value of the original signal when sampled at the symbol boundaries. ',
   '',
   'h = scatterplot(yy, 1, 0, ''c-'');',
   'hold on;',
   'h = scatterplot(yy, N, 0, ''b.'',h);',
   'hold off;',
   ''};

  %========== Slide 9 ==========

  slide(9).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'if ~isempty(h2); if ishandle(h2);close(h2);h2 = [];end;end;',
   'if ~isempty(h3); if ishandle(h3);close(h3);h3 = [];end;end;',
   'SNR = 15;',
   'sig_rx1 = awgn(msg_tx,SNR,''measured'',1234,''dB'');',
   'sig_rx = complex(sig_rx1(:,1),sig_rx1(:,2));',
   '[fsig_rx, t2] = rcosflt(sig_rx, Fd, Fs);',
   'tfsig_rx = fsig_rx(1+Delay*N:end-Delay*(N+1),:);',
   'plot(t, real(y),''b-'', t2, real(fsig_rx),''r-'');',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(9).text={
   'The axes above plots the signal with noise added to it (red line).  Even though the noisy signal can be differentiated from the original signal (blue line), it is still difficult to determine the effect the noise has on the signal.  The signal to noise ratio (SNR) for the noisy signal is 15 dB.',
   '',
   'close(h);h = [];SNR = 15;',
   'sig_rx1 = awgn(msg_tx,SNR,''measured'',1234,''dB'');',
   'sig_rx = complex(sig_rx1(:,1),sig_rx1(:,2));',
   '[fsig_rx, t2] = rcosflt(sig_rx, Fd, Fs);',
   'tfsig_rx = fsig_rx(1+Delay*N:end-Delay*(N+1),:);',
   'plot(t, real(y),''b-'', t2, real(fsig_rx),''r-'');',
   ''};

  %========== Slide 10 ==========

  slide(10).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'if ~isempty(h2); if ishandle(h2);close(h2);h2 = [];end;end;',
   'if ~isempty(h3); if ishandle(h3);close(h3);h3 = [];end;end;',
   'h2 = eyediagram(yy, N,1);',
   'fp = get(h2,''position'');',
   'set(h2,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'h3 = eyediagram(tfsig_rx, N,1,0,''r-'');',
   'set(h3,''position'',[ss(3)*.86-fp(3) ss(4)*.65-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(10).text={
   'These figures are eye diagrams of the original signal (blue lines) and the noisy signal (red lines). The eye diagrams clearly demonstrate the variation in the received signal from the transmitted signal due to the noise added to the signal. ',
   '',
   'h2 = eyediagram(yy, N,1);',
   'h3 = eyediagram(tfsig_rx, N,1,0,''r-'');',
   ''};

  %========== Slide 11 ==========

  slide(11).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'h = scatterplot(yy, N, 0, ''b.'');',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.01 ss(4)*.01 fp(3) fp(4)]);',
   'h1 = scatterplot(tfsig_rx, N, 0, ''r.'');',
   'set(h1,''position'',[ss(3)*.3 ss(4)*.02 fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(11).text={
   'These figures are scatter plots of the original signal (blue dots) and the noisy signal (red dots). The scatter plots clearly demonstrate the variation from the transmitted signal in the received signal at the symbol boundaries. ',
   '',
   'h = scatterplot(yy, N, 0, ''b.'',h);',
   'h1 = scatterplot(tfsig_rx, N, 0, ''r.'',h1);',
   ''};
  %========== Slide 12 ==========

  slide(12).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'if ~isempty(h2); if ishandle(h2);close(h2);h2 = [];end;end;',
   'if ~isempty(h3); if ishandle(h3);close(h3);h3 = [];end;end;',
   'SNR = 20;',
   'sig_rx1 = awgn(msg_tx,SNR,''measured'',4321,''dB'');',
   'sig_rx = complex(sig_rx1(:,1),sig_rx1(:,2));',
   '[fsig_rx2, t2] = rcosflt(sig_rx, Fd, Fs);',
   'tfsig_rx2 = fsig_rx2(1+Delay*N:end-Delay*(N+1),:);',
   'plot(t, real(y),''b-'',t2,real(fsig_rx),''m-'');',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(12).text={
   'This is a plot of the same transmitted signal received at a SNR of 20 dB (magenta line).  The variations caused by noise are smaller than with the previous signal (SNR = 15 dB).  In this case the eye diagrams and scatter plots are needed even more to determine the modulation characteristics.',
   '',
   'close(h);close(h1);close(h2);close(h3);h = [];h1 = [];h2 = [];h3 = [];SNR = 20;'
   'sig_rx1 = awgn(msg_tx,SNR,''measured'',4321,''dB'');',
   'sig_rx = complex(sig_rx1(:,1),sig_rx1(:,2));',
   '[fsig_rx2, t2] = rcosflt(sig_rx, Fd, Fs);',
   'tfsig_rx2 = fsig_rx2(1+Delay*N:end-Delay*(N+1),:);',
   'plot(t, real(y),''b-'',t2,real(fsig_rx2),''m-'');',
   ''};

  %========== Slide 13 ==========

  slide(13).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'if ~isempty(h2); if ishandle(h2);close(h2);h2 = [];end;end;',
   'if ~isempty(h3); if ishandle(h3);close(h3);h3 = [];end;end;',
   'plot(t, real(fsig_rx),''r-'',t2,real(fsig_rx2),''m-'');',
   'h2 = eyediagram(tfsig_rx, N,1,0,''r-'');',
   'fp = get(h2,''position'');',
   'set(h2,''position'',[ss(3)*.99-fp(3) ss(4)*.9-fp(4) fp(3) fp(4)]);',
   'h3 = eyediagram(tfsig_rx2, N,1,0,''m-'');',
   'set(h3,''position'',[ss(3)*.86-fp(3) ss(4)*.65-fp(4) fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(13).text={
   'These figures are eye diagrams of the first noisy signal (red lines) and the second noisy signal (magenta lines). The eye diagrams clearly demonstrate that the variation in the second received signal is less than the first received signal.  The two noisy signals are plotted above for reference. ',
   '',
   'plot(t, real(fsig_rx),''r-'',t2,real(fsig_rx2),''m-'');',
   'h2 = eyediagram(tfsig_rx, N,1);',
   'h3 = eyediagram(tfsig_rx2, N,1,0,''r-'');',
   ''};

  %========== Slide 14 ==========

  slide(14).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   '   if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   '   if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'end',
   'h = scatterplot(tfsig_rx, N, 0, ''r.'',h);',
   'fp = get(h,''position'');',
   'set(h,''position'',[ss(3)*.01 ss(4)*.01 fp(3) fp(4)]);',
   'h = scatterplot(tfsig_rx, N, 0, ''r.'',h);',
   'h1 = scatterplot(tfsig_rx2, N, 0, ''m.'',h1);',
   'set(h1,''position'',[ss(3)*.3 ss(4)*.02 fp(3) fp(4)]);',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   ''};
  slide(14).text={
   'These figures are scatter plots of the first noisy signal (red dots) and the second noisy signal (magenta dots). The scatter plots clearly demonstrate the variation from the second received signal is less than the first received signal at the sampling points.',
   '',
   'h = scatterplot(tfsig_rx, N, 0, ''r.'',h);',
   'h1 = scatterplot(tfsig_rx2, N, 0, ''m.'',h1);',
   ''};

  %========== Slide 15 ==========

  slide(15).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'if ~isempty(h2); if ishandle(h2);close(h2);h2 = [];end;end;',
   'if ~isempty(h3); if ishandle(h3);close(h3);h3 = [];end;end;',
   'plot(t2,real(fsig_rx2),''m-'');',
   'hClose  =    findobj(fig, ''Tag'', ''close'');',
   'stClose = get(hClose,                 ''enable'');',
   'stAuto  = get(slideData.autohandle,   ''enable'');',
   'stReset = get(slideData.resethandle,  ''enable'');',
   'stPrev  = get(slideData.backhandle,   ''enable'');',
   'stNext  = get(slideData.nexthandle,   ''enable'');',
   'set(hClose,                 ''enable'', ''off'');',
   'set(slideData.autohandle,   ''enable'', ''off'');',
   'set(slideData.resethandle,  ''enable'', ''off'');',
   'set(slideData.backhandle,   ''enable'', ''off'');',
   'set(slideData.nexthandle,   ''enable'', ''off'');',
   'set(fig,''CloseRequestFcn'','''')',
   'warning off;',
   '[h, h1] = animatescattereye(tfsig_rx2,N,.1,N,''lin'',-1);',
   'warning on;',
   'set(hClose,                 ''enable'', stClose );',
   'set(slideData.autohandle,   ''enable'', stAuto  );',
   'set(slideData.resethandle,  ''enable'', stReset );',
   'set(slideData.backhandle,   ''enable'', stPrev  );',
   'set(slideData.nexthandle,   ''enable'', stNext  );',
   'set(fig,''CloseRequestFcn'',''playshow #reset; closereq'')',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   '' };
  slide(15).text={
   'This animation of the eye diagram and scatter plot shows that they can be plotted with any offset.',
   '',
   'close(h);close(h1);close(h2);close(h3);h = [];h1 = [];h2 = [];h3 = []'
   'plot(t2,real(fsig_rx2),''m-'');',
   '[h, h1] = animatescattereye(tfsig_rx2,N,.1,N,''lin'',-1);',
   ''};

  %========== Slide 16 ==========

  slide(16).code={
   'if ichange < 1  & SlideShowi>1',
   '   SlideShowVars=slideData.param(SlideShowi-ichange).vars;',
   '   for SlideShown=1:size(SlideShowVars,1)',
   '      eval([SlideShowVars{SlideShown,1} ''=SlideShowVars{SlideShown,2};'']);',
   '   end',
   'end',
   'if ~isempty(h); if ishandle(h);close(h);h = [];end;end;',
   'if ~isempty(h1); if ishandle(h1);close(h1);h1 = [];end;end;',
   'plot(t,real(y),''b-'');',
   'stClose = get(hClose,                 ''enable'');',
   'stAuto  = get(slideData.autohandle,   ''enable'');',
   'stReset = get(slideData.resethandle,  ''enable'');',
   'stPrev  = get(slideData.backhandle,   ''enable'');',
   'stNext  = get(slideData.nexthandle,   ''enable'');',
   'set(hClose,                 ''enable'', ''off'');',
   'set(slideData.autohandle,   ''enable'', ''off'');',
   'set(slideData.resethandle,  ''enable'', ''off'');',
   'set(slideData.backhandle,   ''enable'', ''off'');',
   'set(slideData.nexthandle,   ''enable'', ''off'');',
   'set(fig,''CloseRequestFcn'','''')',
   'warning off;',
   '[h, h1] = animatescattereye(yy,N,.1,17,''lr'',0);',
   'warning on;',
   'set(hClose,                 ''enable'', stClose );',
   'set(slideData.autohandle,   ''enable'', stAuto  );',
   'set(slideData.resethandle,  ''enable'', stReset );',
   'set(slideData.backhandle,   ''enable'', stPrev  );',
   'set(slideData.nexthandle,   ''enable'', stNext  );',
   'set(fig,''CloseRequestFcn'',''playshow #reset; closereq'')',
   'set(slideData.resethandle,''UserData'',SlideShowi);',
   '' };
  slide(16).text={
   'This animation of the eye diagram and scatter plot approximates the effect of timing offsets at the receiver.  The offset parameter in EYEDIAGRAM and SCATTERPLOT are varied about the correct sampling time.  This animates the impact  in time and in signal space of sampling the received signal before and after the correct sampling time.',
   '',
   'close(h1);h1 = [];close(h);h = [];'
   'plot(t2,real(y),''b-'');',
   '[h, h1] = animatescattereye(yy,N,.1,17,''lr'',0);',
   ''};
end