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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Next array element is a function of the previous array element

ptc-4059593
1-Visitor

Next array element is a function of the previous array element

I've reduced an engineering problem down to it's basic form. In this case, I have a repeated series of equations. If there's 10 things being evaluated (the number of "things" is the variable num), then there's 10 equations and 10 unknowns. Each equation has the same form and the solution of the next one is the result of the previous answer (as well as a few other parameters which are mixed in there...these are all assumed constant for this simplified version of what I was trying to do).

So basically, I've been working for a couple hours and reading a few resources and I can't figure out what I'm doing wrong. I tried both recursive and iterative formulations and failed on both. The thing that stumps me is that if this was MATLAB, I would just so something like a for loop where X(i) = aouter(i-1) + ainner(i-1) +X(i-1) and just loop through the i values.

So my troubles might boil down to a few different problems. Maybe I'm confusing ranges/arrays/vectors or maybe I didn't set up the loop properly. At the end, I should be able to print a table where I say "X :=".

Thanks in advance for your help.

ACCEPTED SOLUTION

Accepted Solutions

See attached.

Alan

View solution in original post

4 REPLIES 4

There are a few issues with your worksheet.

  • Firstly you have defined X, so you cannot return the answer from the program.
  • Secondly you haven't defined a.outer or a.inner.

Can you provide an example of the expected results?

Mike

See attached.

Alan

You had it right, just not written correctly.

Thanks guys! I've been using mathcad for a while but I'm just now getting used to the program logic structures. Yeah, that makes sense; after the loop, I have to assign the value or else it calculates and basically just doesn't pass the calculation to the place where I want to store it.

Announcements

Top Tags