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.

Variable limits of integration with Postint

Please login with a confirmed email address before reporting spam

Yesterday I started to use Comsol with Matlab. I need to compute a moving window average of the comsol results, so I integrate

vyint=postint(fem,'v*(x>xlow)*(x<xup)*(y>ylow)*(y<yup)', ...

where the limits of integration are variable (xlow, etc). When I use this with fixed limits of integration there is no problem. When I switch to variable limits I get an error

??? Java exception occurred:
Exception:
com.femlab.server.MlError: Error using ==> feval
Undefined function or method 'ylow' for input arguments of type 'double'.
(rethrown as com.femlab.jni.FlNativeException)
Messages:
Error using ==> feval
Undefined function or method 'ylow' for input arguments of type 'double'.

Failed to evaluate expression
- Expression: v*(x>xlow)*(x<xup)*(y>ylow)*(y<yup)

Failed to evaluate variable
- Variable: xlow
- Geometry: 1
- Subdomain: 1

Post expr failed

So I guess I need to define xlow, etc. in Comsol as another variable. Is this guess right? If so, how to implement it? How else can this problem be solved?

Thanks

1 Reply Last Post Jan 18, 2010, 8:25 a.m. EST
COMSOL Moderator

Hello Eric Morales

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.


Artemio Plana-Fattori

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 18, 2010, 8:25 a.m. EST
Hello,

Just starting with COMSOL & MATLAB, I found your question very useful... because it did help me to clarify the syntax to use in integrating over sub-domains.

Effectively, COMSOL doesn't understand your variables "xlow", "xup", "ylow" and "yup". You can parameterize these limits by using an intermediate variable:

xlow = 1; xup = 2;
ylow = 3; yup = 4;
domain = sprintf('u*(x>%d)*(x<%d)*(y>%d)*(y<%d)', xlow, xup, ylow, yup);
postint(fem,domain)

Values 1, 2, 3, and 4 are arbitrary, you can define the four limits according to your problem.

Best regards.
Hello, Just starting with COMSOL & MATLAB, I found your question very useful... because it did help me to clarify the syntax to use in integrating over sub-domains. Effectively, COMSOL doesn't understand your variables "xlow", "xup", "ylow" and "yup". You can parameterize these limits by using an intermediate variable: xlow = 1; xup = 2; ylow = 3; yup = 4; domain = sprintf('u*(x>%d)*(x%d)*(y

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.