Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Dec 07, 2013
05:10 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 07, 2013
05:10 PM

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.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Dec 08, 2013
06:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 08, 2013
06:59 AM

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.

4 REPLIES 4

Dec 07, 2013
08:25 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 07, 2013
08:25 PM

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.

Dec 08, 2013
06:45 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 08, 2013
06:45 AM

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?

Dec 08, 2013
06:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 08, 2013
06:59 AM

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.

Dec 13, 2013
11:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 13, 2013
11:20 AM

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