pde coefficient as function in 2 space

16 views (last 30 days)
Hello, I am trying to implement a elliptic pde on a 2D rectangular domain by PDE toolbox. The equation is following -div(C.grad(u))=f where C= a known constant but f is function of u as f= (A+u)/B, where A and B are known constant. Now i have two questions- 1. How can I implement the function for the coefficient f as a function? I have tried to put '(A+u)/B' but with error as dimension mismatch issue 2. How can I use workspace variable in the coefficient of pde.
Thanks in advance.
Best regards, Shovon.

Accepted Answer

Ravi Kumar
Ravi Kumar on 26 Oct 2016
Hi Shovon,
You can specify the f-coefficient as a function that depends on u using the function form of PDE coefficient specification as explained here: https://www.mathworks.com/help/pde/ug/f-coefficient-for-specifycoefficients.html
Look for the secion of page beginning with:
If f is not constant, give a function handle. The function must be of the form
fcoeffunction(region,state)
You may want to check the documentation page from your MATLAB installation, as there could be variation from the page above if you are using older version of MATLAB.
-Ravi
  1 Comment
Shovon Goutam
Shovon Goutam on 26 Oct 2016
Thanks Ravi, Meanwhile I was going through Matlab PDE toolbox use guide. And found the solution. I used a separate function but still the solution was giving me error - the matrix dimension mismatch. After reading further, I found out if f is dependent on solution u, I have to change the solver to nonlinear with a initial value. Now the problem is solved. Thank you for your answer. BR, Shovon

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!