Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

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.

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M9512489

Have any Question?


Related Questions in MATLAB

Prepare a 3 - 10 pages long reportprepare a presentation

Prepare a 3 - 10 pages long report Prepare a presentation with 5 - 9 slides. The slides will include introduction (need and similar work), theoretical background (tested neural networks), Data, Results (Comparison of the ...

Assignment matlab programmingusing appropriate matlab

Assignment: MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

Question a safe prime is a prime number that can be written

Question : A safe prime is a prime number that can be written in the form 2p + 1 where p is also a prime number. Write a MATLAB script file that finds and displays all safe primes between 1 and 1000.

Recitation problems -1 determine the highest real root of

Recitation Problems - 1. Determine the highest real root of f(x) = 2x 3 - 11.7x 2 + 17.7x - 5 using the Newton-Raphson method with at least four iterations. Start with an initial guess of x 0 = 3. 2. Determine the real r ...

Assignment details -need to write a code for connecting

Assignment Details - Need to write a code for connecting segments (Lines) a special case of TSP. The problem is to connect lines in 2d/ 3d space with path obstructions. Can you help me write the code for this? Hope you m ...

Suppose that a student has the option of enrolling for a

Suppose that a student has the option of enrolling for a single elective during a term. The student must select a course from a limited list of options: "English, " "History, " "Biology, " "Computer, " or "Math." Constru ...

Assignmentafter the success of your robo-advice venture you

Assignment After the success of your robo-advice venture you decide to explore alternative sources of profitability for your company. You realize that Australian investors are often forced to chose between expensive acti ...

Discrete optimisation- solve the following two problems

Discrete Optimisation - Solve the following two problems with both exhaustive enumeration and branch and bound - Problem 1 is a mixed integer linear optimisation problem (the problem has both discrete and continuous vari ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As