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

What is the velocity of the center-of-mass frame

If the collision is elastic, the velocities of the particles in the center-of-mass frame are changed in direction but not in magnitude. Find an expression relating the angle

Compute maximum tensile stress developed across section a

The cross-sectional area of the link is reduced by one-half at section A-A as shown.- Compute the maximum tensile stress developed across section A-A. Neglect any stress conce

Consisting of an equilibrium mixture

One kmol of CO2 in a piston-cylinder assembly, initially at temperature T and 1 atm, is heated at constant pressure until a final state is attained consisting of an equilibr

Theoretical maximum height that a pump could pull water

Determine the theoretical maximum height that a pump could pull water up from a well (i.e. from the vacuum side of the pump). The set-up described is similar to on-farm wells.

Determine the natural frecuency of the automobile

an automobile having a mass of 2000 kg deflects its suspension springs 0.02 m under static conditions. Determine the natural frecuency of the automobile in the vertical dire

Coal-fired power plant is burning coal with a heating value

A 500 MW coal-fired power plant is burning coal with a heating value of 12,000 Btu/lb. The coal contains 2.0% sulphur. The plant has a thermal efficiency of 38%, and uses an a

Calculate the force on the plate and the moment

A 2-in-diameter stream of water having a velocity of 40 ft/s strikes the edge of a flat plate such that half the stream is deflected downward as shown in Fig. 16.16. Calcula

Was it ethical for engineer a to refuse to sign or seal plan

Was it ethical for Engineer A to refuse to sign or seal the plans? Was it ethical for Engineer B to ask Engineer A to sign and seal the construction documents? If additional

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