Skip to main content
1-Visitor
April 16, 2015
Question

Using range as vector indexed value

  • April 16, 2015
  • 1 reply
  • 1161 views

Hi,

I'm relatively new to Mathcad, and very new to programming. What I would like to do is use a range for a indexed value in a vector (this is my input) and have an output for each value used in the range. One issue is that there are a significant amount of steps from the input to the output, and I don't think it's realistic (for me anyway) to write a program to do the whole thing.

Attached is the mathcad sheet I'm using. The vector I'm looking at is highlighted in yellow on page 4. The value I want to input as a range is the third row. The output is on page 15, also highlighted in yellow.

It would save me a ton of time if I was able to use multiple values in that third row instead of changing it every time.

Hopefully that makes some sense. Thanks!

1 reply

19-Tanzanite
April 16, 2015

Make U a function:

Then F will also be a function, an you can pass it multiple values.

You would be far better off putting all the calculations for one iteration into a program that you can call as a function, and then calling that function in a loop in a second program. If you have to iterate something then typing (or copy and pasting) the same thing multiple times is never the best solution.