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

Problem Generating Output from Program

SOLVED
Newbie

Problem Generating Output from Program

I have created a fairly long and involved MathCAD document. I have reached a point where I want

to calculate the percentage of time that over 6 power phases a minimum stroke current exists. I

have set up what I thought would be a decent way to compute this with six "if" statements in a

"for" loop. All the expressions inside the "for" loop evaluate correctly outside the program. Generally

I am just testing each increment of time for which current among the six is the minimum, and incrementing

a constant by one each time this is true. At the end I simply want spit out an single row array of the final

constant values. Nothing I do seems to generate a result at all. I may have problems with actual units

in the program but I thought the use of distinct constant names (A1...) would be immune to those units

in the other expressions. I attach the program only extracted from the larger document, and disabled.

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Problem Generating Output from Program

I think I spotted the problem. Its the RHS of the line ARR<--(A1,B1,....,C2). You want it to be a row vector but didn't create a matrix there and instead typed a list. Mathcad cannot work with lists other than as argument of functions and so Mathcad sure would throw an error.

You may fix this by either place a 1x6 matrix at the RHS (inserted by typing ctrl-M or via the matrix palette) or even more easy by simply typing augment in front of your RHS, making it read ARR<--augment(A1,B1,....,C2). This will create the necessary row vector - type stack instead of augment if the result should be a column vector.

EDIT: Attached a function you may find useful which does the same as yours but is not limited to exactly 6 signals and exactly 360 elements and it should work no matter what value ORIGIN is set to.

Issue with Program_2.png

4 REPLIES 4

Re: Problem Generating Output from Program

You have a line

t<--i*Delta_t

but nothing in the loop depends on t, so that line has no effect. Also, arrays default to 0, not 1, origin in Mathcad, so your loop should probably start at 0.

Can't say any more than that without more information. We need a worksheet that has defined variables that allow the program to actually run.

Re: Problem Generating Output from Program

Nothing I do seems to generate a result at all.

So what problem are you experiencing? Is Mathcad throwing an error or are you getting a wrong result? If the latter - which result do you get and what did you expect to get?

Re: Problem Generating Output from Program

I think I spotted the problem. Its the RHS of the line ARR<--(A1,B1,....,C2). You want it to be a row vector but didn't create a matrix there and instead typed a list. Mathcad cannot work with lists other than as argument of functions and so Mathcad sure would throw an error.

You may fix this by either place a 1x6 matrix at the RHS (inserted by typing ctrl-M or via the matrix palette) or even more easy by simply typing augment in front of your RHS, making it read ARR<--augment(A1,B1,....,C2). This will create the necessary row vector - type stack instead of augment if the result should be a column vector.

EDIT: Attached a function you may find useful which does the same as yours but is not limited to exactly 6 signals and exactly 360 elements and it should work no matter what value ORIGIN is set to.

Issue with Program_2.png

Re: Problem Generating Output from Program

Werner

Your observation was exactly correct. Once I inserted a matrix the output was generated as expected. A dumb error. Thank you for the insight.

Paul