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.

Error in user-defined matlab function

Please login with a confirmed email address before reporting spam

I am using COMSOL matlab function, and I defined two functions: full_expression_PL(T,z), full_expression_PL_dT(T,z), where full_expression_PL_dT is the derivative respect to T of full_expression_PL. I clicked the Plot, the two functions can be showed successfully. However, when I compute the model, here comes an error:

Error in user-defined function.
- Function: dfull_expression_PL_dT
Failed to evaluate expression.
- Expression: d(d((2*test(mod1.Te)*mod1.Irzt*full_expression_PL(mod1.Te,z)*pi*r)*(dvol),{test@0}),mod1.Te)

The attached file is the Screenshot of the matlab function definition window.

Is there anything wrong in the definition? Does anyone know why this happens?

Thanks!


1 Reply Last Post Oct 17, 2013, 7:05 a.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 17, 2013, 7:05 a.m. EDT
Hi

Its hard to give advise without seeing your m-files.

My guess is that dfull_expression_PL_dT has an error. Have you tried to call it with arguments consisting of column vectors (with suitable values).

Also from the error message it seems as if you also need the second derivative.


Lars Gregersen
Comsol Denmark
Hi Its hard to give advise without seeing your m-files. My guess is that dfull_expression_PL_dT has an error. Have you tried to call it with arguments consisting of column vectors (with suitable values). Also from the error message it seems as if you also need the second derivative. Lars Gregersen Comsol Denmark

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.