ENED 1100 – ACTIVITIES AND HOMEWORK
W7D1: LABVIEW REPETITION
TASK 1 (OF 2)
PART A
Create a Flowchart and develop a LabVIEW VI that computes a sum of odd integers using the equation:
The value of x should start at 0. The final value of the equation 2x+1 (ie: the final odd number added to the sum) should be defined by the user using a numeric input (control) on the Front Panel. The final value of y (ie: the sum of odd numbers) should be displayed for the user using a numeric output (indicator) on the Front Panel.
PART B
To check that your LabVIEW VI is operating correctly, create a trace table that tracks the values of x andy for five iterations (the final value of y should be 1+3+5+7+9=25). Add your trace table to the same file containing your flowchart for submission.
TASK 2 (OF 2)
Repetition flow is often used to create simulations. Using repetition, you can repeatedly simulate events to determine the probability of a given outcome.
Create a LabVIEW VI that simulates the simple experiment of flipping a coin. Remember, flipping a coin can only have two outcomes: Heads, or Tails. Your flow diagram should:
• allow the user to input the number of times to flip the coin,
• determine the result of the coin flip by randomly producing a value corresponding to 1 (heads) or 0 (tails),
• record/track the number of times the coin landed on aheads or a tails, and
• output the final percentage of flips that were heads and the percentage that were tails after all flips have been simulated.
Use the Random Number (0-1) block from the Numeric section of the Functions Palette to simulate your coin flip.
This block will randomly generate a decimal number between 0 and 1. You can use this decimal to determine the result of a coin flip in a number of different ways. You can round the number to the nearest integer (0 or 1), compare the random number to 0.5 to see if it is above or below that midpoint (x>0.5?), or use another similar method.
Random Number Block
NOTE: If you need to flip a coin repeatedly, does the Random Number block need togo inside your loop, or outside of it?