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.

Analytic function with multiple lower/upper limits

Please login with a confirmed email address before reporting spam

Hi,

I'm trying to define an analytic function in the global definition that has multiple definitions over different range. For example, the expression is x, when 0<x<=20; the expression is 2x^2+1 when 20<x<=50, so on. How should I combine them into one analytic function? Or should I just define a bunch of them then somehow use all of them later (in the material properties for example)?

Any help is much appreciated! Thanks!

2 Replies Last Post Aug 26, 2015, 2:21 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Aug 26, 2015, 2:18 a.m. EDT
Hi

I suggest using my favorite, flc2hs:

f(x) = x*(1 - flc2hs(x-20,d)) + (2x² + 1)*flc2hs(x-20,d)*(1-flc2hs(x-50,d)) + flc2hs(x-50,d)*(next function)...

where d is the interval within the step is taken; I use d = 0.001.

A picture attached.

BR
Lasse



Hi I suggest using my favorite, flc2hs: f(x) = x*(1 - flc2hs(x-20,d)) + (2x² + 1)*flc2hs(x-20,d)*(1-flc2hs(x-50,d)) + flc2hs(x-50,d)*(next function)... where d is the interval within the step is taken; I use d = 0.001. A picture attached. BR Lasse


Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Aug 26, 2015, 2:21 a.m. EDT
This is what the Piecewise function type is for.
This is what the Piecewise function type is for.

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.