WTRND Random matrices from a Student's T distribution CALL: R = wtrnd(dfn,sz) R = matrix of random numbers df = degrees of freedom sz = size(R) (Default size(df)) sz can be a comma separated list or a vector giving the size of R (see zeros for options) The random numbers are generated by the inverse method. Examples: R = wtrnd(1,1,100); R2 = wtrnd(1:10); R3 = wtrnd(4,[2 2 3]) See also wtinv
Check if all input arguments are either scalar or of common size. | |
Inverse of the Student's T distribution function | |
Display message and abort function. |
001 function R = rt(df,varargin) 002 %WTRND Random matrices from a Student's T distribution 003 % 004 % CALL: R = wtrnd(dfn,sz) 005 % 006 % R = matrix of random numbers 007 % df = degrees of freedom 008 % sz = size(R) (Default size(df)) 009 % sz can be a comma separated list or a vector 010 % giving the size of R (see zeros for options) 011 % 012 % The random numbers are generated by the inverse method. 013 % 014 % Examples: 015 % R = wtrnd(1,1,100); 016 % R2 = wtrnd(1:10); 017 % R3 = wtrnd(4,[2 2 3]) 018 % 019 % See also wtinv 020 021 022 % Tested on: Matlab 5.3 023 % History: 024 % revised pab 23.10.2000 025 % - added comnsize + nargchk 026 % - added greater flexibility on the sizing of R 027 % Anders Holtsberg, 18-11-93 028 % Copyright (c) Anders Holtsberg 029 030 error(nargchk(1,inf,nargin)) 031 if nargin>1, 032 [errorcode df] = comnsize(df,zeros(varargin{:})); 033 if errorcode > 0 034 error('df must be a scalar or of corresponding size as given by m and n.'); 035 end 036 end 037 csiz=size(df); 038 R = wtinv(rand(csiz),df); 039 040 041 042
Comments or corrections to the WAFO group