Illustration of a conditional loop, MATLAB Programming

Illustration of a conditional loop - While loop:

As an illustration of a conditional loop, we will write a function which will find the first factorial which is greater than the input argument high. Formerly, we wrote a function to compute a specific factorial. For illustration, to compute 5! We found the product 1 * 2 * 3 * 4 * 5. In that situation a for loop was used, as it was known that the loop would be repeated 5 times. Now, we do not know how many times the loop will be repeated. The fundamental algorithm is to have two variables, one that iterates throughout the values 1, 2, 3, and so forth, and one which stores the factorial of the iterator at each step. We begin with 1, and 1 factorial, that is 1. Then, we confirm the factorial. If it is not bigger than high, the iterator variable will then increment to 2, and finds its factorial (2). If this is not greater than high, the iterators will then increment to 3, and the function will also find its factorial (6). This continues till we get to the first factorial which is greater than high. Therefore, the process of incrementing a variable and finding its factorial is repeated till we get to the first value greater than high. This is implemented by using a while loop:

1371_Illustration of a conditional loop.png

Posted Date: 10/19/2012 6:04:07 AM | Location : United States







Related Discussions:- Illustration of a conditional loop, Assignment Help, Ask Question on Illustration of a conditional loop, Get Answer, Expert's Help, Illustration of a conditional loop Discussions

Write discussion on Illustration of a conditional loop
Your posts are moderated
Related Questions
Write a MATLAB program to find the undamped natural frequencies and modes of an electric car treating it as a four degree of freedom system. Determine the undamped natural frequenc

please show me how this is coded in MATLAB

Read the document and quote me ... https://www.dropbox.com/s/pvq4f45fpwajibi/Course_wk%20_2013_.pdf

Vectors and Matrices: The Vectors and matrices are used to store sets of values, all of which are similar type. A vector can either be a column vector or a row vector. The mat

hi, I would like to get quote for my matlab assignment help? thanks

Model the three degree of freedom system shown in Figure Q5 and solve for the displacements of the three masses due to a force of 10 N applied to the bottom mass at a frequency of

The Format Function and ellipsis: The default in MATLAB is to show numbers which have decimal places with four decimal places. The format command can be used to identify the o

Illustration of Variable number of input arguments: In this situation, it was supposed that the radius will always be passed to the function. The function header can hence be

Micro-mouse is an engineering design competition created by IEEE in the late 1970s. Small robotic "mice" solve a 16x16 cell maze. The mice are completely autonomous and must find t