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 the Community Ranking System, a fun gamification element of the PTC Community. X

This array index is invalid for this array

gkdlgod2000
1-Newbie

This array index is invalid for this array

I use mathcad program.

I want to have "sys_r" graph.

I try a below captured programming.

But programming error occurred.

programming error!

Error is "This array index is invalid for this array."

I don't know solution.

Please help me.

zxczxczxc.JPG

graph shape example !

14124.JPG

5 REPLIES 5

Try please ORIGIN:=1

Mathcad counts from 0 by default. Because you set j = 0..2, and you have a 3x3 matrix with elements numbered from 0,0 to 2,2, when j = 2 then j+1 = 3, and there is no element with a j index of 3. Simply setting ORIGIN to 1 (so Mathcad counts from 1 instead of 0) won't cure this as you use both j+1 and j in the routine, so if ORIGIN = 1, you can't have j = 0.

If you correct this, you will have a problem with index i, as this runs from 1 to 3.

Alan

Thanks you.

I clear the error.

But I don't draw a graph.

12.JPG

Different from the example graph.

I want an example graph

I want to have a hint to draw an example graph.

I ask heartily. Plzzzzzzzzzz...

An example of how to plot a vector against its index.

지환 황 wrote:

Thanks you.

I clear the error.

But I don't draw a graph.

12.JPG

Different from the example graph.

I want an example graph

I want to have a hint to draw an example graph.

I ask heartily. Plzzzzzzzzzz...

I suspect the major reason you show a straight line is that your program reassigns the next calculated value to sys_r, so a will get the last value calculated and will be a scalar. If you want to return all of the sys_r values then you need to convert sys_r into a vector (by assigning it an index variable and incrementing the index variable everytime you update sys_r.

See attached worksheet for an example. I haven't tried to fix your program's indexing, just limited j to get it to output something.

Stuart

Top Tags