function slide=intro
% This is a slideshow file for use with playshow.m and makeshow.m
% To see it run, type 'playshow intro', 

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.22 $
if nargout<1,
  playshow intro
else
  %========== Slide 1 ==========

  slide(1).code={
   ' load logo',
   ' surf(L,R), colormap(M)',
   ' n = length(L(:,1));',
   ' axis off, axis([1 n 1 n -.2 .8]), view(-37.5,30)',
   'title(''MATLAB.  The Language of Technical Computing.'');' };
  slide(1).text={
   ' Welcome to MATLAB.  This demonstration (and the '
   ' entire demo system) is written in MATLAB''s fourth ',
   ' generation language.',
   '  ',
   ' Here are the MATLAB commands used to produce the picture',
   ' shown above.',
   ' >> load logo',
   ' >> surf(L,R), colormap(M), n = length(L(:,1));',
   ' >> axis off, axis([1 n 1 n -.2 .8]), view(-37.5,30)',
   ' >> title(''MATLAB.  The Language of Techical Computing.'');'};

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

  slide(2).code={
   'xptext( ''>> a = [1 2 3 4 6 4 3 4 5]'', '' '', ''a ='', '' '', ''   1   2   3   4   6   4   3   4   5'' );' };
  slide(2).text={
   ' First, let''s create a simple vector with 9 elements called ''a''.',
   '',
   ' (During most of this demo, we will display the MATLAB',
   ' commands typed at the command line prompt ">>" and the',
   ' corresponding output in the figure window shown above.)'};

  %========== Slide 3 ==========

  slide(3).code={
   'xptext(''>> b = a + 2'','' '', ''b ='', '' '', ''   3   4   5   6   8   6   5   6   7'' );' };
  slide(3).text={
   ' Now let''s add 2 to each element of our vector, ''a'', and store',
   ' the result in a new vector.',
   '',
   ' Notice how MATLAB requires no special handling of vector',
   ' or matrix math.'};

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

  slide(4).code={
   'cla',
   'a = [1 2 3 4 6 4 3 4 5];',
   'b = a + 2;',
   'plot(b)',
   'grid on' };
  slide(4).text={
   ' Creating graphs in MATLAB is as easy as one command.',
   ' Let''s plot the result of our vector addition with grid lines.',
   '',
   ' >> plot(b)',
   ' >> grid on'};

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

  slide(5).code={
   'bar(b)',
   'xlabel(''Sample #'')',
   'ylabel(''Pounds'')' };
  slide(5).text={
   ' MATLAB can make other graph types as well, with axis labels.',
   '',
   '>>bar(b)',
   '>>xlabel(''Sample #'')',
   '>>ylabel(''Pounds'')'};

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

  slide(6).code={
   'plot(b,''*'')',
   'axis([0 10 0 10])' };
  slide(6).text={
   ' MATLAB can use symbols in plots as well. Here is an',
   ' example using *''s to mark the points.  MATLAB offers a',
   ' variety of other symbols and line types.',
   '',
   ' >> plot(b,''*'')',
   ' >> axis([0 10 0 10])'};

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

  slide(7).code={
   'A = [1 2 0; 2 5 -1; 4 10 -1];',
   'xptext( ''>> A = [1 2 0; 2 5 -1; 4 10 -1]'','' '',''A ='', '' '',''     1     2     0'',''     2     5    -1'',''     4    10    -1'' );' };
  slide(7).text={
   ' One area in which MATLAB excels is matrix computation.',
   '',
   ' Creating a matrix is as easy as making a vector, using',
   ' semicolons (;) to separate the rows of a matrix.'};

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

  slide(8).code={
   'xptext(''>> B = A'''''','' '',''B ='','' '', ''     1     2     4'',''     2     5    10'',''     0    -1    -1'');' };
  slide(8).text={
   'We can easily find the transpose of the matrix ''A''.'};

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

  slide(9).code={
   'xptext(''>> C = A * B'','' '',''C ='','' '',''     5    12    24'',''    12    30    59'',''    24    59   117'');' };
  slide(9).text={
   ' Now let''s multiply these two matrices together.',
   '',
   ' Note again that MATLAB doesn''t require you to deal with',
   ' matrices as a collection of numbers.  MATLAB knows when',
   ' you are dealing with matrices and adjusts your calculations',
   ' accordingly.'};

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

  slide(10).code={
   'xptext(''>> C = A .* B'','' '', ''C ='','' '',''     1     4     0'',''     4    25   -10'', ''     0   -10     1'' );' };
  slide(10).text={
   'Instead of doing a matrix multiply, we can multiply the',
   'corresponding elements of two matrices or vectors',
   'using the .* operator.'};

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

  slide(11).code={
   'xptext( ''>> X = inv(A)'', '' '', ''X ='', '' '',  ''     5     2    -2'',  ''    -2    -1     1'', ''     0    -2     1'' );' };
  slide(11).text={
   ' Let''s find the inverse of a matrix ...'};

  %========== Slide 12 ==========

  slide(12).code={
   'xptext(  ''>> I = inv(A) * A'',   '' '',   ''I ='',  '' '',  ''     1     0     0'',  ''     0     1     0'',  ''     0     0     1'' );' };
  slide(12).text={
   ' ... and then illustrate the fact that a matrix times its inverse is',
   ' the identity matrix.'};

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

  slide(13).code={
   'xptext(  ''>> eig(A)'',   '' '',   ''ans ='',  '' '',  ''    3.7321'',  ''    0.2679'',  ''    1.0000'' );' };
  slide(13).text={
   ' MATLAB has functions for nearly every type of common',
   ' matrix calculation.',
   '',
   ' There are functions to obtain eigenvalues ...'};

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

  slide(14).code={
   'xptext( ''>> svd(A)'',  '' '',  ''ans ='',  '' '',  ''   12.3171'',  ''    0.5149'',  ''    0.1577'');' };
  slide(14).text={
   ' ... as well as the singular value decomposition.'};

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

  slide(15).code={
   'p = round(poly(A));',
   'xptext(  ''>> p = round(poly(A))'',  '' '',  ''p ='',  '' '',   ''     1    -5     5    -1'' );' };
  slide(15).text={
   ' The "poly" function generates a vector containing the',
   ' coefficients of the characteristic polynomial.',
   '',
   ' The characteristic polynomial of a matrix A is',
   '',
   '     det(lambda*I - A)'
};

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

  slide(16).code={
   'xptext(  ''>> roots(p)'',   '' '',   ''ans ='',   '' '',   ''    3.7321'',   ''    1.0000'',   ''    0.2679'' );' };
  slide(16).text={
   ' We can easily find the roots of a polynomial using the',
   ' "roots" function.',
   '',
   ' These are actually the eigenvalues of the original matrix.'};

  %========== Slide 17 ==========

  slide(17).code={
   'q = conv(p,p);',
   'xptext(  ''>> q = conv(p,p)'',  '' '',   ''q ='',  '' '',   ''    1  -10   35  -52   35  -10    1'' );' };
  slide(17).text={
   ' MATLAB has many applications beyond just matrix',
   ' computation.',
   '',
   ' To convolve two vectors ...'};

  %========== Slide 18 ==========

  slide(18).code={
   'r = conv(p,q);',
   'plot(r);',
   '' };
  slide(18).text={
   ' ... or convolve again',
   '',
   ' >> r = conv(p,q); plot(r)',
   '',
   ' and plot the result.'};

  %========== Slide 19 ==========

  slide(19).code={
   'xptext(  ''>> whos'',   ''Name        Size      Bytes  Class'',   '' '',   ''A           3x3          72  double array'',   ''p           1x4          32  double array'',   ''q           1x7          56  double array'',   ''r           1x10         80  double array'',   '' '',   ''Grand total is 30 elements using 240 bytes'' );',
   '' };
  slide(19).text={
   ' At any time, we can get a listing of the variables we have',
   ' stored in memory using the "who" or "whos" command.'};

  %========== Slide 20 ==========

  slide(20).code={
   'set(gca,''box'',''on'')',
   'xptext(  ''>> A'',   '' '',   ''A ='',   '' '',   ''     1     2     0'',   ''     2     5    -1'',   ''     4    10    -1'' );' };
  slide(20).text={
   ' You can get the value of a particular variable by typing its',
   ' name.'};

  %========== Slide 21 ==========

  slide(21).code={
   'xptext(   '' >> sqrt(-1), log(0)'',   ''  '',   '' ans ='',   ''         0 + 1.0000i'',  '' '',  '' Warning: Log of zero'',  '' '',  '' ans ='',  ''   -Inf'');',
   '' };
  slide(21).text={
   ' You can have more than one statement on a single line by',
   ' separating each statement with commas or semicolons.',
   '',
   ' If you don''t assign a variable to store the result of an operation,',
   ' the result is stored in a temporary variable called "ans".'};

  %========== Slide 22 ==========

  slide(22).code={
   'xptext(   '' >> sqrt(-1), log(0)'',   ''  '',   '' ans ='',   ''         0 + 1.0000i'',  '' '',  '' Warning: Log of zero'',  '' '',  '' ans ='',  ''   -Inf'');',
   '' };
  slide(22).text={
   ' In this case, since we separated the statements with commas,',
   ' the result of each operation was echoed to the screen.',
   '',
   ' As you can see, MATLAB easily deals with complex and',
   ' infinite numbers in calculations.'};

  %========== Slide 23 ==========

  slide(23).code={
   'cla',
   'A = zeros(32); A(14:16,14:16) = ones(3);',
   'y = fft2(A);',
   'mesh(abs(y));',
   'title(''Magnitude of Two-Dimensional FFT of a Matrix'')',
   '' };
  slide(23).text={
   ' MATLAB has functions which make it ideal as a signal',
   ' processing tool.',
   '',
   ' For more details, see the demos of the Signal',
   ' Processing Toolbox',
   '',
   ' >> A = zeros(32); A(14:16,14:16) = ones(3);',
   ' >> y = fft2(A);',
   ' >> mesh(abs(y));',
   ' >> title(''Magnitude of Two-Dimensional FFT of a Matrix'')'};

  %========== Slide 24 ==========

  slide(24).code={
   'cla',
   'view(2)',
   'fplot(''humps'',[0,2]), hold on',
   'patch([0.5 0.5:0.01:1 1 0.5],[0 humps(0.5:0.01:1) 0 0],''r'');',
   'hold off',
   'title(''A region under an interesting function.'')',
   '' };
  slide(24).text={
   ' MATLAB also allows you to create and analyze functions',
   ' easily.',
   ' For examples, see the demo "Functions of functions" under',
   ' MATLAB Numerics.',
   ' >> fplot(''humps'',[0,2]), hold on',
   ' >> patch([0.5 0.5:0.02:1 1 0.5],[0 humps(0.5:0.02:1) 0 0],''r'');',
   ' >> hold off',
   ' >> title(''A region under an interesting function.'')'};

  %========== Slide 25 ==========


  if isstudent
  slide(25).code={
   ' membrane(5,15,9,4)',
   ' axis([-1 1 -1 1 -1 .5])',
   ' colormap(hot)'};
  slide(25).text={
   'Thank you for viewing this introduction to MATLAB.',
   '',
   ' ',
   '',
   ' >> membrane(5,15,9,9)',
   ' >> axis([-1 1 -1 1 -1 .5])',
   ' >> colormap(hot)'};

  else
  slide(25).code={
   ' load clown',
   '   cla reset',
   '   image(X), colormap(map), axis image',
   '   set(gca,''XTick'',[],''YTick'',[])' };
  slide(25).text={
   'Thank you for viewing this introduction to MATLAB.',
   '',
   ' ',
   '',
   ' >> load clown',
   ' >> cla reset',
   ' >> image(X), colormap(map), axis image',
   ' >> set(gca,''XTick'',[],''YTick'',[])'};
  end
end
