WGUMBRND Random matrices from a Gumbel distribution. CALL: R = wgumbrnd(a,b,trunc,sz) R = a matrix of random numbers from the Gumbel distribution a, b = parameters of the Gumbel distribution. trunc = 0 regular gumbel distribution (default) 1 truncated gumbel distribution sz = size(R) (Default common size of k,s and m0) sz can be a comma separated list or a vector giving the size of R (see zeros for options). The size of R is the common size of a and b if both are matrices. If either parameter is a scalar, the size of R is the size of the other parameter. R = wgumbrnd(a,b,trunc,m,n) returns an m by n matrix. Example: R=wgumbrnd(5,10,[],1,100); wgumbplot(R); See also wgumbfit, wgumbpdf, wgumbcdf, wgumbinv, wgumbstat
Check if all input arguments are either scalar or of common size. | |
Inverse of the Gumbel distribution function. | |
Display message and abort function. |
Random points from a bivariate DIST2D distribution | |
Random points from a bivariate MDIST2D distribution |
001 function R = wgumbrnd(a,b,trunc, varargin) 002 %WGUMBRND Random matrices from a Gumbel distribution. 003 % 004 % CALL: R = wgumbrnd(a,b,trunc,sz) 005 % 006 % R = a matrix of random numbers from the Gumbel distribution 007 % a, b = parameters of the Gumbel distribution. 008 % trunc = 0 regular gumbel distribution (default) 009 % 1 truncated gumbel distribution 010 % sz = size(R) (Default common size of k,s and m0) 011 % sz can be a comma separated list or a vector 012 % giving the size of R (see zeros for options). 013 % 014 % The size of R is the common size of a and b if both are matrices. 015 % If either parameter is a scalar, the size of R is the size of the other 016 % parameter. R = wgumbrnd(a,b,trunc,m,n) returns an m by n matrix. 017 % 018 % Example: 019 % R=wgumbrnd(5,10,[],1,100); 020 % wgumbplot(R); 021 % 022 % See also wgumbfit, wgumbpdf, wgumbcdf, wgumbinv, wgumbstat 023 024 % Reference: 025 % Johnson N.L., Kotz S. and Balakrishnan, N. (1994) 026 % Continuous Univariate Distributions, Volume 2. Wiley. 027 028 % Tested on: matlab 5.2 029 % History: 030 % revised pab 8.11.1999 031 % updated help header 032 % by Per A. Brodtkorb 26.10.98 033 % revised ms 13.06.2000 034 % - updated header info 035 % - changed name to wgumbrnd (from gumbrnd) 036 % - added w* to used WAFO-files 037 % - enabled use of 5:th argument 038 % - removed stat-toolbox routines 039 % 040 % revised pab 23.10.2000 041 % - added comnsize, nargchk 042 % - added greater flexibility on the sizing of R 043 044 error(nargchk(2,inf,nargin)) 045 if nargin<3| isempty(trunc) 046 trunc=0; %default is not truncated gumbel 047 end 048 if nargin<4, 049 [errorcode a,b] = comnsize(a,b); 050 else 051 [errorcode a,b] = comnsize(a,b,zeros(varargin{:})); 052 end 053 if errorcode > 0 054 error('a and b must be of common size or scalar.'); 055 end 056 R=wgumbinv(rand(size(a)),a,b,trunc); 057 058 059 060 061
Comments or corrections to the WAFO group