Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Modulo function for making pulse train.

Please login with a confirmed email address before reporting spam

Hi,

Trying to make a pulse train by combining the heaviside function with the modulo function, as described in a previous post.

The heaviside works fine for one pulse:
(flc2hs(5- t),1)

But when I substitue t for the modulo function:
flc2hs(5- (mod(t,0.01)),1)
the function gives a constant output of 1.

Could someone explain to me what the modulo function actually does as it is not explained in the help files

Thanks for the help.

3 Replies Last Post 2013年4月5日 GMT-4 13:56
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年1月28日 GMT-5 01:24
Hi

first of all, as you state there are several threads already about how to generate a pulse train, in v4 it has been made very easy with the "periodic" check box too and predefined pulse functions.

One thing with your function, I do not see how you pulse the fall-off, only the riseing edge will smoothened. I do neither not see obviously what you have written wrong, having no access to 3.5 I cannot try.

But, my way, when defining functions like that is to make a "function" and plot that one, there are tools for that inside COMSOL, then start "simple" only with the modulo, then add next layer etc. mostly you see rapidly what is wrong.

I find that there is so many things to rememeber inside COMSOL Multiphysics, especially when you apply the latter, that yo uneed to fins "precedures" to get to your goal, that are generic, rather than remebering everything. So my "procedure" for functions like that is really to define them as "Functions" and test them individually.

Hope this can be of help on your way

--
Good luck
Ivar
Hi first of all, as you state there are several threads already about how to generate a pulse train, in v4 it has been made very easy with the "periodic" check box too and predefined pulse functions. One thing with your function, I do not see how you pulse the fall-off, only the riseing edge will smoothened. I do neither not see obviously what you have written wrong, having no access to 3.5 I cannot try. But, my way, when defining functions like that is to make a "function" and plot that one, there are tools for that inside COMSOL, then start "simple" only with the modulo, then add next layer etc. mostly you see rapidly what is wrong. I find that there is so many things to rememeber inside COMSOL Multiphysics, especially when you apply the latter, that yo uneed to fins "precedures" to get to your goal, that are generic, rather than remebering everything. So my "procedure" for functions like that is really to define them as "Functions" and test them individually. Hope this can be of help on your way -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年1月28日 GMT-5 04:36
That's very helpful!
Thank you for taking the time to answer.

I am just starting a final year project with comsol and am finding it a bit tricky to get the hang of.
That's very helpful! Thank you for taking the time to answer. I am just starting a final year project with comsol and am finding it a bit tricky to get the hang of.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年4月5日 GMT-4 13:56
Hi Adam;


Have a nice day.

I just read you comments and posted messages about pulse train. What version are you using? because currently, I am also using mixed heaviside and modulo functions for periodic steeping of concentrations but I am with v3.5a.
My problem is the same as first posted message on the output of the functions. Do you have any idea on how to set up functions for this periodic stepping?

Thank you and have a great day.


Erwin

Hi Adam; Have a nice day. I just read you comments and posted messages about pulse train. What version are you using? because currently, I am also using mixed heaviside and modulo functions for periodic steeping of concentrations but I am with v3.5a. My problem is the same as first posted message on the output of the functions. Do you have any idea on how to set up functions for this periodic stepping? Thank you and have a great day. Erwin

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.