Get Help

Turn on suggestions

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

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Problem Generating Output from Program

Options

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

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

Showing results for

Highlighted

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

12-07-2013
05:10 PM

12-07-2013
05:10 PM

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

Highlighted

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

12-08-2013
06:59 AM

12-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

Highlighted
##

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

12-07-2013
08:25 PM

12-07-2013
08:25 PM

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.

Highlighted
##

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

12-08-2013
06:45 AM

12-08-2013
06:45 AM

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?

Highlighted

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

12-08-2013
06:59 AM

12-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.

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

12-13-2013
11:20 AM

12-13-2013
11:20 AM

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