How to set the coefficient of PDE equation as a user-defined matlab function?
显示 更早的评论
Hi,
My problem is Possion's equation. I use assempde function to solve my problem in command lines. The coefficient c is denpended on coordinate x,y. But, c cannot be writed as a simple expression with x,y. So I write a function to interpolate the value.
I looked up in the help documnent of "assempde". It says that "The name of a user-defined MATLAB function that accepts the arguments (p,t,u,t0). "
Does it mean I cannot use the coordinate value x,y?
What should the function return? A matrix or a vector??Could you give me more details?
Thanks!
Qingyuan
采纳的回答
更多回答(2 个)
Ruslan
2011-12-8
0 个投票
"The expression is evaluated in a context where the variables x, y, sd, u, ux, uy, and t are row vectors representing values at the triangle centers of mass (t is a scalar). The row vectors contain x- and y-coordinates, subdomain label, solution, x and y derivatives of the solution, and time. u, ux, and uy can only be used if u0 has been passed to assempde. The same applies to the scalar t, which is passed to assempde as time."
What's your version of MATLAB? You can use 'x' and 'y' in your analytical expression in coefficients or as a "row vector of values at the triangle centers of mass".
类别
在 帮助中心 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!