This is a static copy of a profile report

Home

Function details for linspaceThis is a static copy of a profile report

Home

linspace (Calls: 2064, Time: 0.022 s)
Generated 13-Jul-2019 20:40:55 using performance time.
function in file C:\Program Files\MATLAB\R2019a\toolbox\matlab\elmat\linspace.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
ff_ipwkbz_evffunction129
ff_ipwkbz_vf_vecsvfunction1935
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
33
y = d1 + (0:n1).*(d2 - d1)./n1...
20640.008 s37.4%
42
end
20640.002 s7.1%
35
if ~isempty(y)
20640.001 s2.5%
19
n = floor(double(n));
20640.000 s1.8%
16
if nargin == 2
20640.000 s1.0%
All other lines  0.011 s50.3%
Totals  0.022 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function42
Non-code lines (comments, blank lines)15
Code lines (lines that can run)27
Code lines that did run18
Code lines that did not run9
Coverage (did run/can run)66.67 %
Function listing
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 
   2064 
  16
if nargin == 2 
  17 
    n = 100;
< 0.001 
   2064 
  18
else 
< 0.001 
   2064 
  19
    n = floor(double(n)); 
< 0.001 
   2064 
  20
end 
< 0.001 
   2064 
  21
if ~isscalar(d1) || ~isscalar(d2) || ~isscalar(n) 
  22 
    error(message('MATLAB:linspace:scalarInputs'));
  23 
end
< 0.001 
   2064 
  24
n1 = n-1; 
< 0.001 
   2064 
  25
c = (d2 - d1).*(n1-1); %check intermediate value for appropriate treatment 
< 0.001 
   2064 
  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 
   2064 
  32
else 
  0.008 
   2064 
  33
    y = d1 + (0:n1).*(d2 - d1)./n1; 
< 0.001 
   2064 
  34
end 
< 0.001 
   2064 
  35
if ~isempty(y) 
< 0.001 
   2064 
  36
    if d1 == d2 
  37 
        y(:) = d1;
< 0.001 
   2064 
  38
    else 
< 0.001 
   2064 
  39
        y(1) = d1; 
< 0.001 
   2064 
  40
        y(end) = d2; 
< 0.001 
   2064 
  41
    end 
  0.002 
   2064 
  42
end 

Other subfunctions in this file are not included in this listing.