如何用MATLAB产生一组不相关的随机数

来源:百度知道 编辑:UC知道 时间:2024/07/05 04:16:21
均值为0、方差为0.1和0.5的不相关随机序列

前面乘上系数就行了:
0.1*randn(1,20)
ans =
Columns 1 through 6
0.0538 0.1834 -0.2259 0.0862 0.0319 -0.1308
Columns 7 through 12
-0.0434 0.0343 0.3578 0.2769 -0.1350 0.3035
Columns 13 through 18
0.0725 -0.0063 0.0715 -0.0205 -0.0124 0.1490
Columns 19 through 20
0.1409 0.1417
>> 0.5*randn(1,20)
ans =
Columns 1 through 6
0.3357 -0.6037 0.3586 0.8151 0.2444 0.5173
Columns 7 through 12
0.3634 -0.1517 0.1469 -0.3936 0.4442 -0.5735
Columns 13 through 18
-0.5344 -0.4047 -1.4721 0.7192 0.1626 -0.3775
Columns 19 through 20
0.6851 -0.8558
>>

产生均值为0 方差为0.1 的长度为10的随机序列:
0 + sqrt(0.1) * randn(1,10)
ans =

Columns 1 through 9

-0.2057 0.2157 -0.1122 -0.0114 0.7532 -0.1390 -0.1128 0.3747 -0.1937