Skip to main content
1-Visitor
November 4, 2011
Solved

Periodic Functions, How define them?

  • November 4, 2011
  • 2 replies
  • 9193 views

I want something like this:

f(t) = 1 if 2n.T < t <= (2n+1).T T is some constant

f(t) = 0 otherwise

but how can I tell to Mathcad 14 that n belongs to Z, the positive and negative integers ???

MC lets me definde a variable in finite intervals, n:=1.. 10, ok

It would be desirable something like n E Z

can you give me a real example to realize what tools of Mathcad I must use?

Best answer by rag

With the mod-function you are running into problems with neagtive values. The Mathcad modulo mod(x,m) unfortunately gives the result in the interval ]-m; m[ with the same sign as x. So mod (-13, 5) yields -3 and not +2, as we need here. You can use "mod(mod(t,T) + T, T)" as a workaround and stay in [0; m[.

For more complicated functions I would in the first step define an auxiliary function piecewise in one period, e.g. 0 to 2T in your case.

There are a lot of methods which comes to mind, e.g.

- using if-statements (nested, for more complex functions)

- using Mathcads programming facilities (looks best, in my opinion)

- use of the Heaviside function

- using boolean expressions

As a second step I would make this auxiliary function periodic by

- using the floor function, or by

- using a recursive definition

Of course you could combine the two steps in one function.

See the newly attached worksheet - hope it helps.

Regard

WR

2 replies

23-Emerald I
November 4, 2011

starting place

jcoolman1-VisitorAuthor
1-Visitor
November 5, 2011

Nice!

But it's not fully periodic, it fails at the origin.

Anyway, I turn this into a little more complicated issue, what if one wants:

f(t) = t.t if 2n.T < t <= (2n+1).T T is some constant

f(t) = T.(2T-t) if (2n+1)T < t <= (2n+2).T

how define n belongs to Z, infinite set of negative and positive integers.

23-Emerald I
November 5, 2011

Let us see your attempt!

jcoolman1-VisitorAuthor
1-Visitor
April 1, 2012

Thanks winfrod for his brilliant class.