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.

Integration of MATLAB functions with more than one variable

Please login with a confirmed email address before reporting spam

Hi,
I want to realize an integration in COMSOL 4.3a using self-written MATLAB functions.

If I use a test function with one input and one output argument everything works as expected (plotting function, integration).
If I now use a function with two arguments I still can plot the function with respect to x and y, but I will get an error when trying to do an integration:
"Evalutation of result expression - Unknown function or operator."

As I said I can plot the function correctly, so it can be found. And on the other hand functions are also found in integration when using a function with one argument.

Any ideas what could be wrong and what the solution could be?

Best,
Erik

3 Replies Last Post 19 feb 2013, 02:22 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 16 feb 2013, 05:37 GMT-5
Hi Erik!

I cannot really help you, but I'm interested in integrating these kinds of functions!

If you could post here an easy example of what you're doing, I will try to work on it!

Mattia
Hi Erik! I cannot really help you, but I'm interested in integrating these kinds of functions! If you could post here an easy example of what you're doing, I will try to work on it! Mattia

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 18 feb 2013, 10:23 GMT-5
Solution found:

I attached an example file together with the test-functions.

1. put the test-functions in an arbitrary directory and add that path to the matlab-path
2. open the mph-file and solve (test if the functions are accesible by plotting them)
3. evaluate the integrals

The point I was missing is, that I can only use these functions if I add them BEFORE I solve the problem. I was just adding new functions and was wondering why it's not working. This may be something one should add to some manual or so :)

Best, Erik
Solution found: I attached an example file together with the test-functions. 1. put the test-functions in an arbitrary directory and add that path to the matlab-path 2. open the mph-file and solve (test if the functions are accesible by plotting them) 3. evaluate the integrals The point I was missing is, that I can only use these functions if I add them BEFORE I solve the problem. I was just adding new functions and was wondering why it's not working. This may be something one should add to some manual or so :) Best, Erik


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19 feb 2013, 02:22 GMT-5
Good job and good model :-)

Good job and good model :-)

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.