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

Questions Cloud

Calculate the weighted average cost of capital employed : Calculate the weighted average cost of capital employed by filling in the following table. (Round all calculations to four significant digits. Enter percent in decimals.
Explain what the income eect : Explain what the income eect is. You may use plain English or use an illustrative example. However, you must convince me you know what it is without copying a denition. Repeat the above for the substitution eect.
What would you describe as the strengths and weakness : What would you describe as the strengths in your writing
About the indierence curves : Indierence Curves- Explain what an indierence curve is. Explain why an indierence curve always has a negative slope. Indierence curves are concentric to each other. What does an indierence \above" another indierence curve indicate?
Determine number of values of x that are greater than zero : 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
Are strict liability standards fair as general rule : In what situations will a court impose a strict liability standard instead of a negligence standard? Provide a real-world example of a strict liability case. Is imposing this standard fair? Are strict liability standards fair as a general rule?
Persuasive regarding ethical pricing of pharmaceuticals : In “Intellectual Property and Pharmaceutical  Drugs: An Ethical Analysis,” Richard T. De George lays out what he comes to  call the “Status Quo Approach” as a defense of copyright protection of pharmaceuticals.   Do you find this argument persuasive ..
Develop a reasonable way to share the housekeeping costs : Develop a reasonable way to share the housekeeping costs. How should they be allocated? Justify your reasoning and explain.
Genetically modified organisms and business duties : Explain Cooley’s argument in “Genetically  Modified Organisms and Business Duties.”  What would Cooley say about the activities of Monsanto and related in the case study “Monsanto’s Round-Up Ready Wheat”? In general, do you agree or disagree with Coo..

Reviews

Write a Review

Mechanical Engineering Questions & Answers

  Consider a pefc operating with the following specifications

consider a pefc operating with the following specifications 80 and the pressure is 2 atm at the anode and 20 and the

  Calculate percent energy distribution for steam generator

Calculate the percent energy distribution for a steam generator among the following categories: (i) steam, (ii) flue gas losses, (iii) carbon loss in ash (refuse loss), and (iv) miscella- neous heat transfer loss. The steam generator receives 480 sho..

  Stagnation temperature of air be at exit of this compressor

A centrifugal air compressor is driven at 40,300 rpm. The inlet eye of the compressor has a hub diameter of 2.09 in and an an outer diameter of 4.56 in. The impeller tip diameter is 6.97 in. It has been found the compressor ratio is 2.44 and the air ..

  A six cylinder 2-stroke diesel engine running at 120 revmin

a six cylinder 2-stroke diesel engine running at 120 revmin has a bore of 900mm and a stroke of 1300mm. the brake

  What is the speed in mph that the piton tube is measuring

In order to double check your speedometer on your boat you decide to install a pitot tube on the bottom. One tube protrudes straight downward, while the other tube has a 90 degree bend, pointing the tip into the direction of motion. At rest, the wate..

  A circular tube of outer diameter 5 cm and inner diameter 4

a circular tube of outer diameter 5 cm and inner diameter 4 cm is used to convey hot fluid. the inner surface of the

  Steam power plant that operates ideal reheat rankine cycle

Consider a steam power plant that operates on the ideal reheat rankine cycle. Steam enters the high-pressure turbine at 6 mpa and 400°c and leaves at 2 mpa. Steam is reheated to 400°c and expands in the low-pressure turbine to 20 kpa.

  Determine the acceleration of the assembly and the angular

the uniform disk of mass pivots freely on the cart of mass. determine the acceleration of the assembly and the angular

  Calculate the mass of steam in the vessel

A rigid vessel of capacity 0.6 m3 contains dry saturated steam at 4.0 bar. The vessel is cooled until the pressure is reduced to 2.0 bar, Calculate; a) the mass of steam in the vessel.

  A turbine extracts energy from water flowing through

A turbine extracts energy from water flowing through a 11-cm-diameter pipe at a pressure of 700 kPa with an average velocity of 11 m/s. If the turbine is 90 percent efficient, how much energy can be produced if the water is emitted from the turbine t..

  Obtain the equation for the streamline passing through the

a flow is described by velocity field vaibxj where a 2 ms and b 1 1s coordinates are measured in meters. a obtain

  frictionless-piston-cylinder assembly

A closed, frictionless, piston-cylinder assembly contains 4 lbm of H20. Beginning with an initial volume of 10 ft^3, the H2O is compressed slowly until the volume has been reduced to 10 percent of the initial volume. During the process, heat transfer..

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