-
Filter by Topic
Most Popular
All Topics
- List all discussions
CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)
|
Thread index | Previous thread | Next thread | Start a new discussion |
March 18, 2010 4:20pm UTC
CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)
Hello,
I'm trying to build a periodical wave. I want it to be linear, with its first semiperiod as an ascendent linear function, and the second semiperiod as a descendent linear function. Just like in the attached image.
I am using the function flc2hs(x,scale) to define the steps that will build the wave. I have defined two diferent parts:
Increasing part:
flc2hs(t+1e-2, 1e-2) - flc2hs(t, 1e-2)
decreasing part:
flc2hs(t, 1e-2) - flc2hs(t,2e-2)
What i have in mind is to repeat this two steps along t with the mod(a,b) function, and to multiply them with the linear function that will define the wave form(it'll be something linearly time depending).
Could anyone help me doing this two last steps? I've been searching for the mod(a,b) function on the program guide, but there is no explanation about it.
thank you very much
Reply | Reply with Quote | Send private message | Report Abuse
March 18, 2010 9:08pm UTC in response to Tomàs Ribes
Re: CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)
Hi
but you will not really get a "linear function" with the heaviside smooth step functions, however it will be derivable.
When I have a problem with a mathematical function in COMSOL, my way around is to plot it as a "function" see below
Good luck
Ivar
Reply | Reply with Quote | Send private message | Report Abuse
April 3, 2010 3:34pm UTC in response to Ivar Kjelberg
Re: CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)
Hi Ivar,
I've been working on creating this wave, and i ve decided to define it this way:
(t*H0)*(t<0.01)+((0.02-t)*H0)*(t>0.01)
I've realised that what i was trying to do at the beginning was a bit complex. The result is on the attached image. I only need one period of this wave. If i need the wave to be periodic in time, i'll have problems, because this description is not ok, the resultant wave is permanently decreasing from t=0.01. I'll investigate more.
Thanks for the help!
Tomàs
Reply | Reply with Quote | Send private message | Report Abuse
April 4, 2010 6:48am UTC in response to Tomàs Ribes
Re: CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)
Hi
indeed it would most probabay work, if not try to step in a concetrated way at your slope changes. You still have the modulo to make it periodic.
If you still have convergence problems, you could fit a smoother sin function just around your slope change. I mostly use Maple to help me formulate my math for such piecewise continuous functions
Good luck
Ivar
Reply | Reply with Quote | Send private message | Report Abuse
March 22, 2011 10:20pm UTC in response to Ivar Kjelberg
Re: CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)
I too am trying to create a periodic wave with flc2hs in 3.5a.
I applied the following: flc2hs(mod(t,365.2)-120),1)-flc2hs(mod(t,365.2)-150,1))
My t is measured in days so it should be "on" from day 120 to 150, and "off" otherwise, for each 365.2 day cycles. But it only happens the one time.
Is there something I am doing incorrectly?
Thanks!
Mattie
Reply | Reply with Quote | Send private message | Report Abuse
March 23, 2011 6:30am UTC in response to Mattie Whitmore
Re: CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)
Hi
normally t is expressed by default in seconds, so I would use a "t[1/day]" (this works in v4, probably also in 3.5) in your call
Define a function with your expression, that helps to test it, as you can plot it out
and you should check your balance of "()"
--
Good luck
Ivar
Reply | Reply with Quote | Send private message | Report Abuse
Rules and guidelines

