boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
EE版 - matlab 里面的randn
相关主题
Re: 求教:有VHDL格式的随机生成0/1的程序吗?
Re: Matlab数据传递问题
matlab help
怎么产生随机数?
关于在HSPICE下使用Verilog-A自带随机数函数的问题
请教: Artisan SRAM generator 的 综合问题
用什么命令能证明Matlab程序还在运行之中?
问个matlab问题,50伪币酬谢
Re: ◎◎◎◎急,大侠帮忙看看信号发生器◎◎◎◎◎◎
后悔当初没学好概率论
相关话题的讨论汇总
话题: randn话题: matlab话题: random话题: state话题: rand
进入EE版参与讨论
1 (共1页)
m******t
发帖数: 4077
1
randn('state', s) - reset the state to s
这个到底是什么意思啊?
是说如果你连续run s次,出来的random number 都是一样的马?
s****h
发帖数: 921
2
我一般这样做:
rand('state', sum(100*clock));
由当前时间来确定初态。
要不然你每次打开matlab, randn输出的结果一样。
说白来了是pseudo-random.
h***n
发帖数: 36
3
All random number generator in MATLAB is pseudo random generator, so it
starts from a number and do certain operations to get another number. If
you start from the same place, e.g., s, you will always get same series of
random numbers.
In fact MATLAB currently has three random number generators.
If you use 'seed', you are using one of them, if you are using 'state', you
are using another one of them. The best one so far is 'twister', but it may
not be in randn yet.

【在 m******t 的大作中提到】
: randn('state', s) - reset the state to s
: 这个到底是什么意思啊?
: 是说如果你连续run s次,出来的random number 都是一样的马?

r*****f
发帖数: 247
4
没明白, 我直接用randn产生一个1000*1的向量,但是不加任何 state, seed
每次出来的也不一样啊.并不是从同样的数字开始的

you
may

【在 h***n 的大作中提到】
: All random number generator in MATLAB is pseudo random generator, so it
: starts from a number and do certain operations to get another number. If
: you start from the same place, e.g., s, you will always get same series of
: random numbers.
: In fact MATLAB currently has three random number generators.
: If you use 'seed', you are using one of them, if you are using 'state', you
: are using another one of them. The best one so far is 'twister', but it may
: not be in randn yet.

c****g
发帖数: 6
5
s0 = rand('state') %returns the current state of the random number generator,
x = rand(10,1); % generate random number
s1 = rand('state') % returns the current state of the random number
generator
disp([s0,s1]) % you will see s0 and s1 are different,that means the state
changes each time you ran the random number generatror
s0 =rand('state');
x1 = rand;
x2 = rand;
rand('state',s0);
x3 = rand;
x1,x2,x3, $ you will see that x1 = x3, x1~=x2

【在 r*****f 的大作中提到】
: 没明白, 我直接用randn产生一个1000*1的向量,但是不加任何 state, seed
: 每次出来的也不一样啊.并不是从同样的数字开始的
:
: you
: may

r*****f
发帖数: 247
6
now that state change each time I ran the random generator, why should I
specificly use 'seed' or 'state' to manually change it?

generator,

【在 c****g 的大作中提到】
: s0 = rand('state') %returns the current state of the random number generator,
: x = rand(10,1); % generate random number
: s1 = rand('state') % returns the current state of the random number
: generator
: disp([s0,s1]) % you will see s0 and s1 are different,that means the state
: changes each time you ran the random number generatror
: s0 =rand('state');
: x1 = rand;
: x2 = rand;
: rand('state',s0);

s****h
发帖数: 921
7
try:
close MATLAB
open MATLAB
input randn and record the number.
then close MATLAB and open MATLAB
input randn and see what happens.
h***n
发帖数: 36
8
Because sometimes you may want to reproduce the behavior.

【在 r*****f 的大作中提到】
: now that state change each time I ran the random generator, why should I
: specificly use 'seed' or 'state' to manually change it?
:
: generator,

m******t
发帖数: 4077
9
ok, 我理解的意思是如果你每次都从相同的state开始, 出来的结果就是一样的random
sequence, 但是randn('state', 100) 和randn('state', 1)除了是不同的state, 还有
区别马? 都是给定一个起始状态就是了吧.

generator,

【在 c****g 的大作中提到】
: s0 = rand('state') %returns the current state of the random number generator,
: x = rand(10,1); % generate random number
: s1 = rand('state') % returns the current state of the random number
: generator
: disp([s0,s1]) % you will see s0 and s1 are different,that means the state
: changes each time you ran the random number generatror
: s0 =rand('state');
: x1 = rand;
: x2 = rand;
: rand('state',s0);

z*****n
发帖数: 7639
10
给一个seed并不能让输出变成真正的random,
seed只是改变了输出序列的开始值。

【在 s****h 的大作中提到】
: 我一般这样做:
: rand('state', sum(100*clock));
: 由当前时间来确定初态。
: 要不然你每次打开matlab, randn输出的结果一样。
: 说白来了是pseudo-random.

z*****n
发帖数: 7639
11
matlab的randn里面应该有随机化机制。我的经验跟你一样。

【在 r*****f 的大作中提到】
: 没明白, 我直接用randn产生一个1000*1的向量,但是不加任何 state, seed
: 每次出来的也不一样啊.并不是从同样的数字开始的
:
: you
: may

1 (共1页)
进入EE版参与讨论
相关主题
后悔当初没学好概率论
可以用MGF(moment generating function)方法求取非连续变量吗?
求助: Multiple Radar targets generation
求random bit generator 的模块,在cadence下
请问:信号发生器
有关high voltage power combiner
Waveform/Function generator IC?
谁能推荐一款芯片用于多通道Arbitrary Waveform Generator
需要一个high power,high current的pulse generator,哪里能找到?
function generator
相关话题的讨论汇总
话题: randn话题: matlab话题: random话题: state话题: rand