Determine number of values of x that are greater than zero

Assignment Help Mechanical Engineering
Reference no: EM13860284

The purpose of this assignment is to investigate a Monte Carlo Simulation to numerically calculate the area under a Gaussian PDF as in Figure 8.10-a of your text (the Q(y) function).

One of the most useful methods to determine the integral of function that cannot be performed in closed form are the so-called Monte Carlo methods. For the particular method that we are using here, matlab will generate a large number of gaussian distributed random numbers. The fraction of these numbers greater than a value. y will be the value of Q(y).

This works because the PDF for a gaussian is normalized, iePx(x)dx = 1

To generate a 1 dimensional array of gaussian random numbers in matlab use the randn(M,N) function.

For example to generate 10000 random numbers we can use

N=10000;

x=randn(1,N);

If we want to determine the number of values of x that are greater than zero we can use code similar to the following

x0=x ./abs(x); % converts the array elements to ±1

x1=(x0+1)/2; % converts the array elements to 1s and 0s

n0 = (z1*ones(N,1))/N;

% n0 is the fraction of array elements that are greater than 0

Of course, due to the symmetry of the pdf, the answer should be .5. Implementing this code should give one confidence that the method works. Note that the answer might not come out to be .5 unless N is big enough. Try for N=10, N=100, N=1000, N=10000;, N=100000;

N=1000000, and N=10000000;

randn(M, N) generates gaussian random numbers with 0 mean and unity variance. To change to a mean in and variance a. remember the new sequence can be formed form the orginal sequence, x, by

σx(x + m)

To compare to a value y rather than 0, just subtract y from the random variables and test for greater than zero.

Assignment:

1. Complete the code for arbitrary, m, σx and y.

2. Test when m = 0, σx = 1, and y = 0 and various N's to verify your answer is .5.

3. Rerun part 2 when σx = .01, .1, 10, and 100. Are your results what you expect? Why or why not?

4. Test when m = 5, σx = 1, and y = 5, 7, 9, 11. Are your results what you expect? Why or why not?

5. Reran part 5 when σx = .01, .1, 10, and 100. Are your results what you expect? Why or why not?

Note: this should be implemented using no for loops.

Reference no: EM13860284

Determine the shear and moment diagrams

Consider a simply supported beam of length 50ft subjected to a uniformly distributed downward load of 10kips/ft from x=10ft to x=40ft and concentrated downward loads of 100kip

What is the factor of safety n against tearing

If the longitudinal seam along the ridge tears open when it is subjected to a tensile load of 540 pounds per inch of seam, what is the factor of safety n against tearing whe

Determine the centroid using the composite areas method

For the composite shaped areas determine, The centroid using the composite areas method ( Y^ only ) The moment of inertia of the composite areas with respect to the Y^ (Neutra

What is the area of research

you must explicitly state your research questions and summarise your proposal and rationale. Your introduction must contain the following information: a brief outline of the

Determine the temperature of refrigerant exiting compressor

Refrigerant R134a is compressed under steady conditions from a saturated vapour at 100 kPa to 500 kPa. The compressor’s isentropic efficiency is 85%. Heat losses from the comp

Find the maximum and minimum values of r

The mass is struck by a sudden sharp blow, giving it instantaneous velocity of 1 m/s radially outward. Show the state of the system before and after the blow on a sketch of

Determine the pressure of the mixture

A rigid tank contains 1 kmol of Ar gas at 220 K and 5 MPa. A valve is now opened and 3 kmol of N2 gas is allowed to enter the tank at 190 K and 8 MPa. The final mixture temp

Maximum theoretical value of the number

An inventor claims to have developed a power cycle operating between hot and cold reservoirs at 1000 K and 250 K, respectively, that develops net work equal to a multiple of

Reviews

Write a Review

 
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd