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.
How to do "if---else" in comsol GUI?
Posted 2011年1月22日 GMT-5 11:28 Parameters, Variables, & Functions Version 4.0 1 Reply
Please login with a confirmed email address before reporting spam
How to write the equivalent "phi" expression in GUI according to the codes below ?
if x==0
if y>0
phi=0.5*pi
else
phi=-0.5*pi
else if x>0
if y>0
phi=atan(y/x)
else
phi=2*pi+atan(y/x)
else
phi=pi+atan(y/x)
ps: x, y are the space independent variables, phi is a user-defined variable
my ways is: phi=(x==0&&y>0)*(0.5*pi)+(x==0&&y<=0)*(-0.5*pi)+(x>0&&y>0)*(atan(y/x))+(x>0&&y<=0)*(2*pi+atan(y/x))+(pi+atan(y/x)). Is it right? or are there better ones?
if x==0
if y>0
phi=0.5*pi
else
phi=-0.5*pi
else if x>0
if y>0
phi=atan(y/x)
else
phi=2*pi+atan(y/x)
else
phi=pi+atan(y/x)
ps: x, y are the space independent variables, phi is a user-defined variable
my ways is: phi=(x==0&&y>0)*(0.5*pi)+(x==0&&y<=0)*(-0.5*pi)+(x>0&&y>0)*(atan(y/x))+(x>0&&y<=0)*(2*pi+atan(y/x))+(pi+atan(y/x)). Is it right? or are there better ones?
1 Reply Last Post 2011年1月22日 GMT-5 12:34