找回密码
 注册

扫一扫,访问微社区

2019年EDA365年度技术峰会
查看: 20|回复: 1

MATLAB —— 认识一下gallery 中的 uniformdata

[复制链接]

该用户从未签到

发表于 2019-12-4 09:32 | 显示全部楼层 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
( I$ s1 h! y; E
Test matrices
" U+ f6 z# _1 h1 c1 A
gallery是一个产生测试矩阵的函数。下面讲解其语法以及用法描述,数据手册上的英文很简单,耐心看,我就不一一翻译了。. B3 `2 g2 g$ ]9 Q  R; ]$ u
& J9 B% h+ y7 K# [$ h' G5 k
* E& t, j! m; j" }
Syntax
/ T/ M4 P& ~; q% `" q" F4 f& l) ~" F. e; [3 K
& }; h2 r# f6 `# w7 B
[A,B,C,...] = gallery(matname,P1,P2,...)0 ?# J1 a7 K( z0 q+ Z
[A,B,C,...] = gallery(matname,P1,P2,...,classname)
4 `: H( X- ?) O5 P# fgallery(3)1 S) m) @7 k* E7 e
gallery(5)5 [' s  B( u3 u! Q" O1 z! `

& c* H" q( `  Y
$ g8 y2 s  y: a& l( P9 A' A3 ]! K3 iDescription
4 J" a* m. ]1 M0 T) w8 e& U% h
* S+ g' p, V1 J2 I- k/ {[A,B,C,...] = gallery(matname,P1,P2,...) returns the test matrices specified by matname. The matname input is the name of a matrix family selected from the table below. P1,P2,... are input parameters required by the individual matrix family. The number of optional parameters P1,P2,... used in the calling syntax varies from matrix to matrix. The exact calling syntaxes are detailed in the individual matrix descriptions below.0 \* b2 F9 R( N1 q0 g; m
- W% d: n3 ?5 \' ^* ~
[A,B,C,...] = gallery(matname,P1,P2,...) 1 W  U7 o6 N) u/ D) r
% {. b( T5 X) \, X  a
这种语法格式,matname代表的是矩阵族的名称,例如本文要重点突出的uniformdata,产生的矩阵将是一个元素符合均匀分布的矩阵。P1,P2,...是各个矩阵族所需的输入参数。它定义了需要产生的矩阵的维度等。具体要看各个具体的矩阵族。
6 D4 [9 e7 u& l, Q
- f' R9 F* U& Q, A[A,B,C,...] = gallery(matname,P1,P2,...,classname) produces a matrix of class classname. The classname input must be either 'single' or 'double' (unless matname is'integerdata', in which case 'int8', 'int16', 'int32', 'uint8', 'uint16', and 'uint32' are also allowed). If classname is not specified, then the class of the matrix is determined from those arguments among P1,P2,... that do not specify dimensions or select an option. If any of these arguments is of class single then the matrix is single; otherwise the matrix is double.
3 b0 s, f0 p0 V& j% q7 e
' v- y2 d* {2 v( Z( V[A,B,C,...] = gallery(matname,P1,P2,...,classname)5 D* w4 _+ A, S( i  @* G% M

0 z7 S( A& V  ?' e这种语法格式与第一种不同在于它有一个类名,用于定义数据的类,是single还是double。如果未指定classname,则根据P1,P2,......中未指定维度或选择选项的参数确定矩阵的类。如果这些参数中的任何一个是single类,则矩阵是single的; 否则矩阵是double的。  }( [" ]0 l& J& o' y5 x+ {
- J' \0 @  }% P6 c$ m! K
gallery(3) is a badly conditioned 3-by-3 matrix and gallery(5) is an interesting eigenvalue problem.6 D5 a, y1 p7 j( m. j0 i% C3 k
7 m+ B8 Y' U2 P4 o9 ?, u4 g: \
gallery(3)是一个条件差的3乘3矩阵,而gallery(5)是一个有趣的特征值问题。' G( F6 s; r6 }3 s& @' F

, a* U0 `; u- IThe gallery holds over fifty different test matrix functions useful for testing algorithms and other purposes.
0 c% U8 y0 q: p/ _
, K# t* F$ V% C9 r; K该库拥有50多种不同的测试矩阵函数,可用于测试算法和其他目的。' r; f2 E% k& o& h2 a4 @) I8 p

! x8 q3 \) g, G3 p8 {6 W
- O; n/ c7 E! \1 ^uniformdata — Array of arbitrary data from standard uniform distribution& N* B# ?# d! D. A
+ J2 t1 Q8 I4 L, U: W! h* F
1 _4 T' W, b1 _! }6 `
A = gallery('uniformdata',[m,n,...],j) returns an m-by-n-by-... array A. The values of A are a random sample from the standard uniform distribution. j must be an integer value in the interval [0, 2^32-1]. Calling gallery('uniformdata', ...) with different values of j will return different arrays. Repeated calls to gallery('uniformdata',...) with the same size vector and j inputs will always return the same array.7 r* @2 {1 {( H

' g4 s. R( @; ~$ f7 kIn any call to gallery('uniformdata', ...) you can substitute individual inputs m,n,... for the size vector input [m,n,...]. For example, gallery('uniformdata',[1,2,3,4],5) is equivalent to gallery('uniformdata',1,2,3,4,5).( Z* w% E, N! w4 f( B( b, _

" r: m. E% x2 g7 D9 ^  Y[A,B,...] = gallery('uniformdata',[m,n,...],j) returns multiple m-by-n-by-... arrays A, B, ..., containing different values.
' B: L  ^& t) ^2 {% z3 E
- `! ~1 {; Q: y; @# TA = gallery('uniformdata',[m,n,...],j, classname) produces a matrix of class classname. classname must be either 'single' or 'double'.& c8 @  o. e" O: N

3 L0 [8 K  T( H; w9 GGenerate the arbitrary 6-by-4 matrix of data from the uniform distribution on [0, 1] corresponding to j = 2.4 i  R% y: S1 A7 _! \6 H

1 t- {. E' h- z" o& x. F! o9 R: u5 Px = gallery('uniformdata', [6, 4], 2);. G. z% M8 `. o- s4 {
# z) `; M  W5 c! e

, w/ }8 O4 v) {* T
# G1 h2 u+ f0 {  t% ]& ?& M& M( I: |  }2 X7 n! T4 z% C
Generate the arbitrary 1-by-2-by-3 single array of data from the uniform distribution on [0, 1] corresponding to j = 17.
9 d  i" o4 s5 s6 M7 D' r+ R
2 Q% T/ t/ o" K  l/ Oy = gallery('uniformdata', 1, 2, 3, 17, 'single');
: x; s4 i- ^. U: t+ c/ }* Z8 A; }8 a  ~  j0 I9 J# k: [( k+ R
$ T' ~) N  X% _, T* J3 F, z8 x" w

" z8 p: p8 S. X' P
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号 )

GMT+8, 2019-12-6 23:19 , Processed in 0.062500 second(s), 20 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19925233282

快速回复 返回顶部 返回列表