Looping statements, MATLAB Programming

Assignment Help:

Looping Statements:

Consider the problem of computing the area of a circle with radius of 0.3 centimeters-a MATLAB program certainly is not required to do that; you would use your calculator rather than, and punch in π* 0.3 2. Though, if a table of circle areas is preferred, for radii ranging from 0.1 centimeters to 100 centimeters in steps of 0.05 (example 0.1, 0.15, 0.2, etc.), it would be very tiresome to use a calculator and write it all down. This is one of the huge uses of a computer-the ability to repeat a process such as this.

This section will cover statements in MATLAB which allow the other statement(s) to be repeated. The statements which do this are known as the looping statements, or loops. There are two basic types of loops in the programming: counted loops, and conditional loops. The counted loop is one which repeats statements in a specified number of times (example, ahead of time it is known how many times the statements are to be repeated). In a counted loop, for illustration, you might tell 'repeat these statements 10 times.' The conditional loop also repeats the statements, but ahead of time it is not known how many times the statements will require to be repeated.

With a conditional loop, for illustration, you might tell 'repeat these statements until this condition becomes false.' The statement(s) which are repeated in any loop are known as the action of the loop.

There are two different loop statements in the MATLAB: the for statement and the while statement. In practice, the for statement generally used as the counted loop, and while is used as the conditional loop. To keep it easy, that is how they will be represented here.

Finally, though loops are extremely helpful in most programming applications, in MATLAB they are often not necessary, particularly when dealing with the arrays. The concept of vectorizing will be introduced, that is the term used in MATLAB for rewriting code which was written by using loops in a traditional programming language to matrix operations in the MATLAB.


Related Discussions:- Looping statements

Obtain the input - algorithms, Obtain the input - Algorithms: From whe...

Obtain the input - Algorithms: From where does the input come? The two possible choices would be from an external file on a disk, or from the user, who enters the number by ty

Refrigerant cycle, i want the MATLAB code for properties of refrigerant R13...

i want the MATLAB code for properties of refrigerant R134a, Pentane and VCR Refrigeration cycle. Thanks

Create a model or spreadsheet in matlab, The pressure radiated by a column ...

The pressure radiated by a column of in-phase monopole sources may be expressed as: Create a model (spreadsheet / MATLAB etc) for a 6 element column, where d=0.2m . Figure

Triple the fundamental frequency, For the signal with four harmonics (first...

For the signal with four harmonics (first to fourth) that can be obtained from the script, do the following: a)  Place the time domain signal for the case in which all the harmo

Create multiplicative binomial model calculator, You are asked to create an...

You are asked to create an american option multiplicative binomial model calculator in MatLab. Both put and call options should be valued. Given u, d, S 0 , K, r, and T (the usual

Efficient method, The Efficient Method: Though, in MATLAB, there is an...

The Efficient Method: Though, in MATLAB, there is another built-in function which specifically produces random integers, i.e. randint. Calling the function with randint (1,1,n

Determine standard deviation, Find f(t) for each F(s): Problem: ...

Find f(t) for each F(s): Problem: Based on an examination given to a large class in which the maximum score is 100 points, assuming that 20 grades taken at random f

Physics, how do you make a program for a parachute man falling to determine...

how do you make a program for a parachute man falling to determine his terminal velocity, having in consideration the drag force (cv^2). I have the formula to be v(i+1)=v(i)*delta(

Simulation of a pn junction, would you please send the programing code simu...

would you please send the programing code simulation.

Write Your Message!

Captcha
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