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.

COMSOL expression evaluation

Please login with a confirmed email address before reporting spam

Hi all,

In COMSOL I am using two expressions to calculate a certain parameter, and the objective is to pick the one that under given conditions gives a result, which is a real number and 0<=x<=1). I can easily plug a MATLAB routine to do the assesment and pick the value calculated from either of the two expressions, but I always consider the use of MATLAB from COMSOL as last resort, so maybe there is a way to do it with some smart formula in COMSOL?

Any help will be very much appreciated,
Mike

4 Replies Last Post 04.07.2012, 03:45 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10.02.2012, 02:46 GMT-5
Mike,

you could try to use boolean expressions, like

x*(x>=0 & x<=1) This would result in the value of x between 0 and 1 and 0 elsewhere.

Cheers
Edgar
Mike, you could try to use boolean expressions, like x*(x>=0 & x

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10.02.2012, 12:18 GMT-5
Thanks. This is better than nothing.

Cheers, M.
Thanks. This is better than nothing. Cheers, M.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 03.07.2012, 11:15 GMT-4
Hi Edgar,
Is it x*(x>=0 & x<=1) OR x*(x>=0 && x<=1) ?
Hi Edgar, Is it x*(x>=0 & x=0 && x

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 04.07.2012, 03:45 GMT-4
Hi

have you read te help on "Special Operators" and "Unary and Binary Operators"

seem to go more towards && and || in COMSOL;)

--
Good luck
Ivar
Hi have you read te help on "Special Operators" and "Unary and Binary Operators" seem to go more towards && and || in COMSOL;) -- Good luck Ivar

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.