[simulations] improved univariate data exercise
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
% getting familiar with the randn() function:
|
||||
randn(1, 3)
|
||||
randn(3, 1)
|
||||
randn(2, 4)
|
||||
|
||||
% simulate tiger weights:
|
||||
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
|
||||
@@ -12,3 +13,8 @@ for n = [100, 10000]
|
||||
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]')
|
||||
|
||||
Reference in New Issue
Block a user