Mindmajix

Miscellaneous Solved Problems in Repetition and Loop

1. Create a VI to find the factorial of the given number using For Loop and Shift Registers.
Solution The front panel has the number and its factorial, while the block diagram contains the codes to solve the problem as shown in Figures P4.1(a) and P4.1(b).

factorial of the given number using For Loop and Shift Registers

2. Create a VI to find the sum of first n natural numbers using a While Loop with a feedback node.
Solution The front panel and the block diagram to solve the problem are shown in Figures P4.2(a) and P4.2(b). Given a number n, the sum of first n natural numbers is obtained when the program is run.

to find the sum of first n natural numbers using a While Loop with a feedback node

3.Create a VI to change the state of the Boolean indicator n times between TRUE and FALSE.
Solution Build the front panel and the block diagram as shown in Figures P4.3(a) and P4.3(b) to solve the problem.

to change the state of the Boolean indicator n times between TRUE and FALSE.

4.Create a VI to find the sum of first 10 natural numbers using a For Loop.
Solution The front panel and the block diagram to solve the problem are shown in Figures P4.4(a) and P4.4(b).

Screenshot_84

5. Create a VI which converts a decimal number to a binary number using For Loops.
Solution The front panel and the block diagram to convert a decimal number to a binary number are shown in Figures P4.5(a) and P4.5(b).

converts a decimal number to a binary number using For Loops

6. Create a VI to find the factorial of a given number using a While Loop.
Solution The front panel and the block diagram to find the factorial are shown in Figures P4.6(a) and P4.6(b).

the factorial of a given number using a While Loop

7. Create a VI to find ncr and npr of a given number using a For Loop.
Solution The front panel and the block diagram to find ncr and npr are shown in Figures P4.7(a) and P4.7(b).

to find ncr and npr of a given number using a For Loop

8. Create a VI to animate a bird flying. Use the Picture Ring control to insert and display pictures to be animated.
Solution The front panel and the block diagram to solve an animate-a-bird-flying problem are shown in Figures P4.8(a) and P4.8(b).

animate a bird flying

9. Create a global VI (Global1.vi) which consists of a knob and a stop button. Create another VI (plot.vi) consisting of a waveform chart. Update the values of Global1.vi’s knob and plot.vi’s slide in the waveform chart. Press the stop button of the Global1.vi to stop both the VIs.
Solution The front panel is shown in Figures P4.9(a) and P4.9(b) and the block diagram to solve the global variable problem are shown in Figure P4.9(c).

global VI (Global1.vi) which consists of a knob and a stop button

10. Using the Global1.vi created in Problem number 9, write the variation of knob values in a file using Write to Measurement File.vi. Stop the VI using the stop button of Global1.vi.
Solution The block diagram to solve the problem is shown in Figure P4.10.

the variation of knob values in a file using Write to Measurement File.vi

11. Create a global VI (Global2.vi) with a waveform chart and a stop button. Update the waveform chart using a random number generator from another VI (chart.vi). Stop the VIs by pressing the stop button of any one of the VIs.
Solution The front panel is shown in Figures P4.11(a) and P4.11(b), and the block diagram to solve the problem is shown in Figure P4.11(c).

Front Panel Global2.vi

Front Panel & block Diagram of chart.vi


0 Responses on Miscellaneous Solved Problems in Repetition and Loop"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.