time   | Calls   |  line  | 
|---|
 |  |    1   | function y = linspace(d1, d2, n)
   | 
 |  |    2   | %LINSPACE Linearly spaced vector.
   | 
 |  |    3   | %   LINSPACE(X1, X2) generates a row vector of 100 linearly
   | 
 |  |    4   | %   equally spaced points between X1 and X2.
   | 
 |  |    5   | %
   | 
 |  |    6   | %   LINSPACE(X1, X2, N) generates N points between X1 and X2.
   | 
 |  |    7   | %   For N = 1, LINSPACE returns X2.
   | 
 |  |    8   | %
   | 
 |  |    9   | %   Class support for inputs X1,X2:
   | 
 |  |   10   | %      float: double, single
   | 
 |  |   11   | %
   | 
 |  |   12   | %   See also LOGSPACE, COLON.
   | 
 |  |   13   | 
 
  | 
 |  |   14   | %   Copyright 1984-2016 The MathWorks, Inc.
   | 
 |  |   15   | 
 
  | 
< 0.001   |       2   |   16  | if nargin == 2 
   | 
 |  |   17   |     n = 100;
   | 
< 0.001   |       2   |   18  | else 
   | 
< 0.001   |       2   |   19  |     n = floor(double(n)); 
   | 
< 0.001   |       2   |   20  | end 
   | 
< 0.001   |       2   |   21  | if ~isscalar(d1) || ~isscalar(d2) || ~isscalar(n) 
   | 
 |  |   22   |     error(message('MATLAB:linspace:scalarInputs'));
  | 
 |  |   23   | end
   | 
< 0.001   |       2   |   24  | n1 = n-1; 
   | 
< 0.001   |       2   |   25  | c = (d2 - d1).*(n1-1); %check intermediate value for appropriate treatment 
   | 
< 0.001   |       2   |   26  | if isinf(c) 
   | 
 |  |   27   |     if isinf(d2 - d1) %opposite signs overflow
   | 
 |  |   28   |         y = d1 + (d2./n1).*(0:n1) - (d1./n1).*(0:n1);
   | 
 |  |   29   |     else
   | 
 |  |   30   |         y = d1 + (0:n1).*((d2 - d1)./n1);
   | 
 |  |   31   |     end
   | 
< 0.001   |       2   |   32  | else 
   | 
< 0.001   |       2   |   33  |     y = d1 + (0:n1).*(d2 - d1)./n1; 
   | 
< 0.001   |       2   |   34  | end 
   | 
< 0.001   |       2   |   35  | if ~isempty(y) 
   | 
< 0.001   |       2   |   36  |     if d1 == d2 
   | 
 |  |   37   |         y(:) = d1;
   | 
< 0.001   |       2   |   38  |     else 
   | 
< 0.001   |       2   |   39  |         y(1) = d1; 
   | 
< 0.001   |       2   |   40  |         y(end) = d2; 
   | 
< 0.001   |       2   |   41  |     end 
   | 
< 0.001   |       2   |   42  | end 
   | 
Other subfunctions in this file are not included in this listing.