cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

3-Visitor

## For/If Loop (matlab to mathcad)

Hi, how do I write this for loop in MathCad?

My fb is (similar to the first line of code)

**Side note: I need to evaluate these values as rc goes from 2-60.

5 REPLIES 5
23-Emerald III
(To:sydfus)

The matlab code appears to use fb as an array, rather than a function. If you do need a FOR loop in Mathcad, you need to make sure that you work with arrays.

If you:

- Explain what the matlab code is supposed to do, and

Success!
Luc

3-Visitor
(To:LucMeekes)

This is my homework question as well, just to give you some background on why I need rc to go from 2-60.

3-Visitor
(To:sydfus)

The matlab code says that if fb > fst, then we need to set fb=fst and calculate T04 instead of taking the T04 we were given. If fb<fst than we keep the T04 we were given and can continue to calculate for P04.

16-Pearl
(To:sydfus)

See attached.  Notes:

i) I've set the ORIGIN to 1 to match that of Matlab.

ii) I've used subscripts, which are Mathcad's equivalent to Matlab's indexing.

iii) I'm not sure the "if" condition, that you were unsure of, was worth incorporating as the condition is never met (at least, not in the data set you supplied)!

Alan

23-Emerald I
(To:AlanStevens)

Well, here's a start.  Two files attached, one a Prime 6.0 Express, and a pdf of that file.

You need to check units, either use them (I suggest) or don't at all, things get confusing when you mix!  I applied units to get an equation to balance.  You also had an unsubscripted  g  that Mathcad assumed was a built-in constant.

This will at least give you a place to start.

Announcements