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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Problem Generating Output from Program

pdorvel
1-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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

4 REPLIES 4
RichardJ
19-Tanzanite
(To:pdorvel)

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.

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?

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

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

Top Tags