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 October 24, 2018, 8:24 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.

See Also This Related BrainMass Solution

Matlab to determine closed-loop transfer functions

Problem 1:
A unity negative feedback system has the open-loop transfer function.
G(s) = (s + 1)/(s3 + 4s2 + 6s + 10)
1. Using MATLAB, determine the closed-loop transfer function.
2. Using MATLAB, find the roots of the characteristic equation.
3. Is the system stable, marginally stable, or unstable?
4. Use ltiview to determine the overshoot, rise time, and settling time in response to a unit step function.
5. Use ltiview to obtain a pole/zero map.

Figure 1

Figure 1
Problem 2:
Consider the feedback and control system in Figure 1 above.

1. Using the for function, develop a MATLAB script to compute the closed-loop transfer function poles for and plot the results denoting the poles with the "X" symbol. 50≤≤K

2. Determine the maximum range of K for stability with the Routh-Hurwitz method.

3. Compute the roots of the characteristic equation when K is the minimum value allowed for stability.

View Full Posting Details