Discussion Forum

COMSOL expression evaluation

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   2 Replies   Last post: February 10, 2012 5:18pm UTC
Mike Brown

Mike Brown

February 10, 2012 2:03am UTC

COMSOL expression evaluation

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Edgar Kaiser

Edgar Kaiser

February 10, 2012 7:46am UTC in response to Mike Brown

Re: COMSOL expression evaluation

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Mike Brown

Mike Brown

February 10, 2012 5:18pm UTC in response to Edgar Kaiser

Re: COMSOL expression evaluation

Thanks. This is better than nothing.

Cheers, M.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines