16 lines
395 B
Matlab
16 lines
395 B
Matlab
% simulate tiger weights:
|
|
mu = 220.0; % mean and ...
|
|
sigma = 40.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
|
|
|
|
% plot the data:
|
|
plot(x(1:1000), 'o')
|
|
xlabel('Index')
|
|
ylabel('Weight [kg]')
|