Explore BrainMass

loops in MATLAB

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

1) OK, please just create mfile basic programs to say calcluate the sum of any series for example using a while loop, a for loop, and if statement, if else, switch statement.

Also, prompt the user to enter a value or values, use relational operators, logicals like and,or,not if possible.

I just want to learn and see done programs with all these things. If their is a way to keep them mostly the same so I may compare to see differences this is good., it may reduce amount of help I ask of you. Also, if can also use the max and index functions to find the numbered element that would help too

2) A mfile program using a while loop until a condition is met and a program to approximate for 400 terms using a for loop. Finally, on the loops, please place some comments on what is going on if ok


© BrainMass Inc. brainmass.com December 19, 2018, 10:38 pm ad1c9bdddf

Solution Summary

It provides samples codes to realize the 'loop function' in MATLAB. The solution is detailed and was rated '5/5' by the student who originally posted the questions.