Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programming an iterative loop

Status
Not open for further replies.

ElVar

Chemical
Feb 8, 2013
2
Hello everyone,
I am new in programming with Mathcad, as up to now I have only used it for simple calculations. I now want to solve an energy balance which needs to be solved iteratively. The error I get is not enough memory for this peration but I am guessing I am doing something wrong with arrays. Apart from that, I am also wondering whether my way of thinking is the wrong one for Mathcad, since I am trying to solve it in the same way I do it in Matlab.
I would really appreciate any help.
El.
 
Replies continue below

Recommended for you

Your getting a memory because your loop hasn't ended after 23 iterations.

Your "while loop" counter needs to be inside the "while loop" syntax

i.e : t <-- t + 1

However from looking at your program I don't think it will work as intended.

Dave, Msc(Eng), AMIMechE
Graduate Mechanical Engineer
(3 Years left for Chartership!)
 
Apologies for the typos, i really should proof read more, it was indeed in my last appraisal.

*You're getting a memory error...

Dave, Msc(Eng), AMIMechE
Graduate Mechanical Engineer
(3 Years left for Chartership!)
 
Not to discourage you from programming, but the problem doesn't really need a program loop. It looks to be solvable with Given-Find or Minerr, which are described in the Help entries. They will do the iterative solution on their own; you simply need to provide guess values and all the constraints.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
I agree with IRstuff, read up on the "Find" capability and try to re-write it. Once I learned to use it, it has come in very handy.
 
Dear all,
Thank you very much for taking the time to have a look at my problem. I had tried to use the given/find way, however I couldn't make it work and I thought it could be because I am looking to find the solution as a function of time. I will try it again and see how it goes.
Thanks again,
El
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor