matlab unit8 用法

我遇到了这么个M文件:里面有一句代码如下:data=uint8([73intergrationtime13]);我实在看不懂,只知道unit8是代表无符号8位数字,0-2... 我遇到了这么个M文件:里面有一句代码如下:data=uint8([73 intergrationtime 13]); 我实在看不懂,只知道unit8是代表无符号8位数字,0-255,不知道unit8作为函数的用法求大神指点呀。 展开
 我来答
杨好巨蟹座
2015-10-07 · TA获得超过5万个赞
知道大有可为答主
回答量:6197
采纳率:80%
帮助的人:1198万
展开全部
rand产生的是0到1(不包括1)的随机数.
matlab的rand函数生的是伪随机数,即由种子递推出来的,相同的种子,生成相同的随机数.
matlab刚运行起来时,种子都为初始值,因此每次第一次执行rand得到的随机数都是相同的.
1.多次运行,生成相同的随机数方法:
用rand('state',S)设定种子
S为35阶向量,最简单的设为0就好
例: rand('state',0);rand(10)
2. 任何生成相同的随机数方法:
试着产生和时间相关的随机数,种子与当前时间有关.
rand('state',sum(100*clock))
即: rand('state',sum(100*clock)) ;rand(10)
只要执行rand('state',sum(100*clock)) ;的当前计算机时间不现,生成的随机值就不现.
也就是如果时间相同,生成的随机数还是会相同.
在你计算机速度足够快的情况下,试运行一下:
rand('state',sum(100*clock));A=rand(5,5);rand('state',sum(100*clock));B=rand(5,5);
A和B是相同.
所以建议再增加一个随机变量,变成:
rand('state',sum(100*clock)*rand(1));
%
据说matlab 的rand 函数还存在其它的根本性的问题,似乎是非随机性问题.
没具体研究及讨论,验证过,不感多言.
有兴趣的可以查阅:
<<A strong nonrandom pattern in Matlab default random number generator>>

Petr Savicky
Institute of Computer Science
Academy of Sciences of CR
Czech Republic
savicky@cs.cas.cz
September 16, 2006
Abstract
The default random number generator in Matlab versions between 5 and at least
7.3 (R2006b) has a strong dependence between the numbers zi+1, zi+16, zi+28 in the
generated sequence. In particular, there is no index i such that the inequalities
zi+1 < 1/4, 1/4 zi+16 < 1/2, and 1/2 zi+28 are satisfied simultaneously. This
fact is proved as a consequence of the recurrence relation defining the generator. A
random sequence satisfies the inequalities with probability 1/32. Another example
demonstrating the dependence is a simple function f with values −1 and 1, such that
the correlation between f(zi+1, zi+16) and sign(zi+28 − 1/2) is at least 0.416, while it
should be zero.
A simple distribution on three variables that closely approximates the joint
distribution of zi+1, zi+16, zi+28 is described. The region of zero density in the
approximating distribution has volume 4/21 in the three dimensional unit cube. For
every integer 1 k 10, there is a parallelepiped with edges 1/2k+1, 1/2k and 1/2k+1,
where the density of the distribution is 2k. Numerical simulation confirms that the
distribution of the original generator matches the approximation within small random
error corresponding to the sample size.
Sievers分析仪
2024-09-13 广告
是的。传统上,对于符合要求的内毒素检测,最终用户必须从标准内毒素库存瓶中构建至少一式两份三点标准曲线;必须有重复的阴性控制;每个样品和PPC必须一式两份。有了Sievers Eclipse内毒素检测仪,这些步骤可以通过使用预嵌入的内毒素标准... 点击进入详情页
本回答由Sievers分析仪提供
电动炉钩子
2013-10-11 · TA获得超过1568个赞
知道小有建树答主
回答量:614
采纳率:0%
帮助的人:782万
展开全部
就是改变数据类型。那句话把double型的矩阵转换成了uint8型。
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式