PDE coefficient f is a row vector but pdenonlin cannot recognize it

1 次查看(过去 30 天)
Dear all,
when I try to solve the PDE problem with PDETOOL Programmatically, I met a problem about the PDE coefficient.
The function form is:
-∇ · (c∇u) + au = f on Ω
And my f=Ex.*ux+Ey.*uy with Ex and Ey row vectors from calculation, and when I try
[U] = pdenonlin(b,p,e,t,c,a,f,'Jacobian','full','U0',U_noll),
it gives the error msg: Undefined function or variable 'Ex'.
But actually I have Ex and Ey defined already, and they are shown also in Workspace.
Is anybody have any idea about how to solve that?
Thanks a lot!
ZW
  1 个评论
Bill Greene
Bill Greene 2012-8-24
Hi,
pdetool doesn't evaluate the coefficients in the MATLAB base workspace so it doesn't "see" your Ex and Ey vectors. One way to define your f coefficient is to define a MATLAB function that takes the arguments p,t,u,t0 and returns the f vector. You would need to redefine your Ex and Ey vectors inside this function. Also, you would need to evaluate the gradient explicitly inside this function: [ux,uy] = pdegrad(p,t,u);
Finally, you would enter the name of this function in the "f" text box of PDE Specification dialog in pdetool.
Use of functions for defining PDE coefficients is documented in more detail in the section describing assempde.
Bill

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by