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 25 ago 2015, 16:24 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 25 ago 2015, 15:52 GMT-4
Make use of the "step" function definitions in the definition of a new analytic function.

Or in simple steps, for example:

1 - Define a new step centered around 20 that goes from 1 to 0. Call it step1.
2 - Define a new analytic function, call it an1. In the expression field write: step1(x)*x

You know have a function that is equal to x from 0 to 20.... And you could add in the expression field a second function that's zero everywhere except 20 to 50 and so on.

You probably want to use the built-in primitives (step, rectangle, etc.) but you can also go with logical functions ( eg (x <5) is another step function that goes from 1 to zero at 5 ). The problem is that these are not smooth so they could lead to trouble.
Make use of the "step" function definitions in the definition of a new analytic function. Or in simple steps, for example: 1 - Define a new step centered around 20 that goes from 1 to 0. Call it step1. 2 - Define a new analytic function, call it an1. In the expression field write: step1(x)*x You know have a function that is equal to x from 0 to 20.... And you could add in the expression field a second function that's zero everywhere except 20 to 50 and so on. You probably want to use the built-in primitives (step, rectangle, etc.) but you can also go with logical functions ( eg (x

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 25 ago 2015, 16:24 GMT-4
Thanks for the information.

I managed to use the Piecewise function to solve the problem. But I guess your suggestion also should work.
Thanks for the information. I managed to use the Piecewise function to solve the problem. But I guess your suggestion also should work.

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.