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

1 view (last 30 days)
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 Comment
Bill Greene
Bill Greene on 24 Aug 2012
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

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!