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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How do I program a Step Function in Mathcad?

amaurer
1-Newbie

How do I program a Step Function in Mathcad?

I have a data set that fluctuates between high and low values. For context, the data set represents the number of wells needed by month. It is a 12x1 vector (see attached worksheet). I need to program a loop (see my attempt) that can calculate the total number of wells needed when the number of wells increases. For instance, if in month 1, I have 10 wells and month 2 has 9 wells, I still need a total of ten wells. However, if in month 3, I need 12 wells, then I need 2 additional wells, for a total of 12 wells. I need to graph the number of wells needed over time, so it would be helpful to not have any zeros in my vector, and rather maintain the same value until the value increases. Also, if I reach the maximum number of wells, I need to be able to reflect this in the vector for the rest of the year (i.e. (10,9,12,12,12,12,12.etc.).

1 ACCEPTED SOLUTION

Accepted Solutions

6 REPLIES 6
StuartBruff
23-Emerald II
(To:amaurer)

Anne Maurer wrote:

I have a data set that fluctuates between high and low values. For context, the data set represents the number of wells needed by month. It is a 12x1 vector (see attached worksheet). I need to program a loop (see my attempt) that can calculate the total number of wells needed when the number of wells increases. For instance, if in month 1, I have 10 wells and month 2 has 9 wells, I still need a total of ten wells. However, if in month 3, I need 12 wells, then I need 2 additional wells, for a total of 12 wells. I need to graph the number of wells needed over time, so it would be helpful to not have any zeros in my vector, and rather maintain the same value until the value increases. Also, if I reach the maximum number of wells, I need to be able to reflect this in the vector for the rest of the year (i.e. (10,9,12,12,12,12,12.etc.).A

Anne,

I'm afraid I don't have a version of Mathcad that will read an xmcd file, but I'm guessing that the attached M11 worksheet might do what you want?

Stuart

In one line

f.kohlhepp wrote:

In one line

Two! You had to define the range variable.

MikeArmstrong
5-Regular Member
(To:StuartBruff)

Neat trick by Fred though.

Mike

http://communities.ptc.com/servlet/JiveServlet/showImage/2-149416-2532/bar_anim.gif

Mike Armstrong wrote:

Neat trick by Fred though.

That it was.

My churlish and jealous nature means he'll never hear that from me, though.

Besides, he's a colonial and praise will only lead to his getting ideas above his station.

MikeArmstrong
5-Regular Member
(To:StuartBruff)

My churlish and jealous nature means he'll never hear that from me, though.

Come on..... I've seen you heap out praise before.... Haven't I????

http://communities.ptc.com/servlet/JiveServlet/showImage/38-1286-6353/Duh.gif

Mike

Top Tags