• Nie Znaleziono Wyników

Task 1. /1 point/ Generate n = 100, 1000, 10000, . . . random numbers from uniform distribution U[0, 1]. Plot histograms and compare to probability density function. Exemplary code in MATLAB:

N/A
N/A
Protected

Academic year: 2021

Share "Task 1. /1 point/ Generate n = 100, 1000, 10000, . . . random numbers from uniform distribution U[0, 1]. Plot histograms and compare to probability density function. Exemplary code in MATLAB:"

Copied!
1
0
0

Pełen tekst

(1)

Urszula Libal Modelling and Identication 1.1

1. Generation of random numbers (inverse method)

Task 1. /1 point/ Generate n = 100, 1000, 10000, . . . random numbers from uniform distribution U[0, 1]. Plot histograms and compare to probability density function. Exemplary code in MATLAB:

subplot(2,1,1) n = 100;

u = rand(n,1);

hist(u)

title(['Histogram for n = ', int2str(n)]) subplot(2,1,2)

x = -0.1:0.002:1.1;

pdf = unifpdf(x);

plot(x, pdf, 'Color', 'red', 'LineWidth', 3) xlim([-0.05 1.05])

ylim([-0.2 1.2])

title('Probability Density Function')

Task 2. /4 points/ Apply inverse method to generate random numbers from the following distributions:

No Distribution name Probability density function

f (x|µ, σ) = exp (

x−µσ

)

σ ( 1+exp (

x−µσ

))

2

, σ > 0 1 Logistic

f (x|µ) = µ 1 exp 

µ x 

, x > 0, µ > 0 2 Exponential

f (x|c) = c−|x| c

2

, |x| 6 c, c > 0 3 Triangular

f (x|µ, σ) = 1

πσ h

1+ (

x−µσ

)

2

i , σ > 0 4 Cauchy

Inverse method:

1. Generate u ∼ U[0, 1].

2. For the designed p.d.f. f(x) compute F () and its inverse F −1 () . 3. Compute F −1 (u) .

Plot histograms for generated data. Plot theoretical probability density functions - see pdf function in MATLAB.

/Total: 5 points/

Cytaty

Powiązane dokumenty

As consequences of inequality (1) we can estimate the oscillation of poste- rior distributions under (small) violations of the assumed prior distribution and we can conclude that

Task 1. mixture of beta distributions with dierent parameters in case 3) - use normpdf, unifpdf and betapdf in case 1, 2 and 3 respectively.. Note that the integral of the new pdf

After a shop opens at 09:00 the number of customers arriving in any interval of duration t minutes follows a Poisson distribution with mean..

You are not required to find the coordinates of the

The speeds of the cars passing the school at Myśliwiecka are normally di- stributed.. 37% of the cars exceed the speed limit and 7% of the cars exceed this limit by more than 10

 () argumenty funkcji, wyrazy tablic,

Let X denote the random variable, of values equal to the number of bits in error, in a sequence of 4 bits. E - bit error, O -

• It is often tempting to select the observations that are most convenient as the sample or to exercise judgment in sample