Skip to main content
1-Visitor
February 9, 2011
Solved

How do I program a Step Function in Mathcad?

  • February 9, 2011
  • 2 replies
  • 12576 views

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

Best answer by f.kohlhepp

In one line

2 replies

23-Emerald V
February 9, 2011

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

1-Visitor
February 9, 2011

In one line

23-Emerald V
February 9, 2011

f.kohlhepp wrote:

In one line

Two! You had to define the range variable.

1-Visitor
February 10, 2011

Neat trick by Fred though.

Mike

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