Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
mu = 1; sd = 0.5;
x = randn(1000,1) * sd + mu;

View file

@ -0,0 +1 @@
x = normrnd(mu, sd, [1000,1]);

View file

@ -0,0 +1,15 @@
function randNum = randNorm(mu0,chi2, sz)
radiusSquared = +Inf;
while (radiusSquared >= 1)
u = ( 2 * rand(sz) ) - 1;
v = ( 2 * rand(sz) ) - 1;
radiusSquared = u.^2 + v.^2;
end
scaleFactor = sqrt( ( -2*log(radiusSquared) )./ radiusSquared );
randNum = (v .* scaleFactor .* chi2) + mu0;
end

View file

@ -0,0 +1,5 @@
>> randNorm(1,.5, [1000,1])
ans =
0.693984121077029