[simulations] exercise for normal data
This commit is contained in:
14
simulations/code/normaldata.m
Normal file
14
simulations/code/normaldata.m
Normal file
@@ -0,0 +1,14 @@
|
||||
randn(1, 3)
|
||||
randn(3, 1)
|
||||
randn(2, 4)
|
||||
|
||||
mu = 220.0; % mean and ...
|
||||
sigma = 30.0; % ... standard deviation of the tigers in kg
|
||||
|
||||
for n = [100, 10000]
|
||||
fprintf('\nn=%d:\n', n)
|
||||
for i = 1:5
|
||||
x = sigma*randn(n, 1) + mu; % weights of n tigers
|
||||
fprintf(' m=%3.0fkg, std=%3.0fkg\n', mean(x), std(x))
|
||||
end
|
||||
end
|
||||
31
simulations/code/normaldata.out
Normal file
31
simulations/code/normaldata.out
Normal file
@@ -0,0 +1,31 @@
|
||||
>> normaldata
|
||||
|
||||
ans =
|
||||
|
||||
-0.89120 1.19863 0.95487
|
||||
|
||||
ans =
|
||||
|
||||
-1.10001
|
||||
0.79473
|
||||
0.85979
|
||||
|
||||
ans =
|
||||
|
||||
-1.19206 0.58278 1.70286 -1.28122
|
||||
-0.19966 -1.85623 0.17962 -0.19272
|
||||
|
||||
|
||||
n=100:
|
||||
m=218kg, std= 31kg
|
||||
m=227kg, std= 29kg
|
||||
m=224kg, std= 28kg
|
||||
m=214kg, std= 26kg
|
||||
m=219kg, std= 30kg
|
||||
|
||||
n=10000:
|
||||
m=220kg, std= 30kg
|
||||
m=220kg, std= 30kg
|
||||
m=220kg, std= 30kg
|
||||
m=220kg, std= 30kg
|
||||
m=220kg, std= 30kg
|
||||
Reference in New Issue
Block a user