This is a static copy of a profile report

Home

normrnd (40 calls, 0.019 sec)
Generated 04-Aug-2014 13:05:20 using cpu time.
function in file /share/apps/matlabr2014a/toolbox/stats/stats/normrnd.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
BGC_DO_simsvdICfunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
31
[err, sizeOut] = statsizechk(2...
400.013 s66.7%
39
r = randn(sizeOut) .* sigma + ...
400.006 s33.3%
37
sigma(sigma < 0) = NaN;
400 s0%
32
if err > 0
400 s0%
27
if nargin < 2
400 s0%
All other lines  0.000 s0.0%
Totals  0.019 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
stats/private/statsizechkMEX-file400 s0%
Self time (built-ins, overhead, etc.)  0.019 s100.0%
Totals  0.019 s100% 
Code Analyzer results
Line numberMessage
1Extra semicolon is unnecessary.
Coverage results
Show coverage for parent directory
Total lines in function39
Non-code lines (comments, blank lines)30
Code lines (lines that can run)9
Code lines that did run5
Code lines that did not run4
Coverage (did run/can run)55.56 %
Function listing
time 
calls 
 line
   1 
function r = normrnd(mu,sigma,varargin);
   2 
%NORMRND Random arrays from the normal distribution.
   3 
%   R = NORMRND(MU,SIGMA) returns an array of random numbers chosen from a
   4 
%   normal distribution with mean MU and standard deviation SIGMA.  The size
   5 
%   of R is the common size of MU and SIGMA if both are arrays.  If either
   6 
%   parameter is a scalar, the size of R is the size of the other
   7 
%   parameter.
   8 
%
   9 
%   R = NORMRND(MU,SIGMA,M,N,...) or R = NORMRND(MU,SIGMA,[M,N,...])
  10 
%   returns an M-by-N-by-... array.
  11 
%
  12 
%   See also NORMCDF, NORMFIT, NORMINV, NORMLIKE, NORMPDF, NORMSTAT,
  13 
%   RANDOM, RANDN.
  14 

  15 
%   NORMRND uses Marsaglia's ziggurat method.
  16 

  17 
%   References:
  18 
%      [1] Marsaglia, G. and Tsang, W.W. (1984) "A fast, easily implemented
  19 
%          method for sampling from decreasing or symmetric unimodal density
  20 
%          functions", SIAM J. Sci. Statist. Computing, 5:349-359.
  21 
%      [2] Evans, M., Hastings, N., and Peacock, B. (1993) Statistical
  22 
%          Distributions, 2nd ed., Wiley, 170pp.
  23 

  24 
%   Copyright 1993-2004 The MathWorks, Inc. 
  25 

  26 

     40 
  27 
if nargin < 2 
  28 
    error(message('stats:normrnd:TooFewInputs'));
  29 
end
  30 

  0.01 
     40 
  31 
[err, sizeOut] = statsizechk(2,mu,sigma,varargin{:}); 
     40 
  32 
if err > 0 
  33 
    error(message('stats:normrnd:InputSizeMismatch'));
  34 
end
  35 

  36 
% Return NaN for elements corresponding to illegal parameter values.
     40 
  37 
sigma(sigma < 0) = NaN; 
  38 

< 0.01 
     40 
  39 
r = randn(sizeOut) .* sigma + mu;