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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

For/If Loop (matlab to mathcad)

sydfus
3-Visitor

For/If Loop (matlab to mathcad)

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

 

sydfus_0-1586292148726.png

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

sydfus_1-1586292235858.png

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

 

5 REPLIES 5
LucMeekes
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

- Attach your Mathcad file

We may be able to help you.

 

Success!
Luc

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

sydfus_0-1586295423015.png

 

sydfus
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.

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

 

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.

Top Tags