1: the difference of 'script file' and 'function file':
 
 a: 'the script file' (class1.m)
    
    x1 = 2;
    y1 = x1^2;
    x2 = 0:0.1:1; % generate an array
    x3 = linspace(0,1,11); %generate the same array as x2
    A = [0,1,2;3,4,5;7,8,9]; % create a matrix 3 by 3
    B = ones(5,5);
    C = rand(5,5);
    SUM_x = sum(x2); % the sum of the elements of x
    SUM_A = sum(A);  % sum the elements in every column
    DIAG_A = diag(A); % get the diagonal element of A
  
 b: 'function file' (my_function.m)
    functions can be nested
    
   function [y1,y2] = my_function(x1,x2)
   % this is my own defined function
   x= my_func1(x1);
   y1 = exp(x);
   y2 = cos(x2^2);

   function y = my_func1(x)
   z = my_func(x); 
   y = sin(x);

   function z = my_func(x)
   z = x.^3;

2: 'for' loops
    class1_2.m

   for i = 1:101;
   
   x(i) = sin(i)/i;
   
     if (i > 50)
       break; % see the difference of y when you use 'return'.
     end
   
   end
   y = x;

3: Go to 'help' whenever you have questions.
   two kinds of 'help': use 'help' command to 
               get the help for the functions you want to use
     OR come to my office to ask for help! 
