Lab 6 Simulation of Random Systems.docx

This command will generate a single random integer

Info icon This preview shows pages 1–5. Sign up to view the full content.

This command will generate a single random integer, either 1 or 2, and store that value in the variable flip. We will assume that a 1 is a heads and a 2 is a tails. 5) Display the number of times each outcome occurs as well as compute and display the probabilities (as a percentage) for each outcome
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Based on your own knowledge and experience with coins, what should the probability be for flipping a head or a tail? 50% Now, test your hypothesis by running your script with the following number of flips and record the counts and probabilities that result: Table 1: Coin Flipping Results Number of Flips Count of Heads Probability of Heads Count of Tails Probability of Tails 10 2 20.00% 8 80% 100 47 47.00% 53 53.00% 1000 513 51.30% 487 48.70% 1000000 499581 49.96 % 500419 50.04 % How do the results of your simulations compare to the values you expected initially? The first trial went completely different. But the rest of the tests were pretty similar to what I originally thought it would be. Paste your script below: clear;close all ; clc rng( 'shuffle' ); heads = 0; tails = 0 ; times = input( 'How many times do you want to flip the coin ' ); for k = 1:times flip = randi([1,2],1); if flip ==1 heads = heads+1; elseif flip ==2 tails = tails+1; end end fprintf( ' It landed on heads %0.2f times \n' ,heads) fprintf( ' It landed on tails %0.2f times \n' ,tails) headspercent = (heads*100)/times; tailspercent = (tails * 100)/times; fprintf( ' The probability of heads is %0.2f %% \n' ,headspercent) fprintf( ' The probability of tails is %0.2f %% \n' ,tailspercent)
Image of page 2
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Mass of vehicle Mass of shock absorber Figure 1: Simplified Vehicle Suspension Model Shock spring Tire spring y1 y2 C. Effects of Tolerance on a System Now that you’ve had a chance to simulate a random process, let’s move on to something more interesting (i.e. challenging). When designing an actual system, the components that you use will have some tolerance range that determines how they will perform. For instance, if you’ve taken ENED1020, you saw during the basic electricity experiment that resistors have a tolerance, usually on the order of 5-10%. What that means is that the value of the resistor may vary from the expected value by 10%, both above and below that expected value. This variance in the actual resistance, if not taken into account when designing a circuit, can cause issues in the functionality of the system. The same holds true for the output of motors, the strength of steel beams, or, in our case, the spring constant of a spring. The system that we will be modeling is that of the suspension in a car. In most cars, the suspension consists of two parts: the shock absorber and the tire.
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '13
  • ossman

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern