2
$\begingroup$

I'm new to the PDE toolbox in Matlab. From the PDE specification window of the toolbox, it looks like one can only solve PDE with constant coefficients.

enter image description here

How can I use Matlab's PDE toolbox to solve PDE like

$$ \partial_t P(x,y,t)=x\partial_xP(x,y,t)+(y-1)\partial_yP(x,y,t)+2P(x,y,t)? $$

$\endgroup$
1

2 Answers 2

3
$\begingroup$

In general, PDE Toolbox is able to solve 2D PDE in the form shown on this page:

PDE Form

Any of those coefficients (e.g. c, a, f, d) can be functions of x, y, t, u, $\frac{\partial u}{\partial x}, \frac{\partial u}{\partial y}$.

If the coefficients are relatively simple expressions, the simplest way to define them is by typing a string expression in text boxes above (e.g. 1+x.^2+4*y). That approach is documented on this page:

Coefficients defined with string expressions

If the coefficients are more complicated, it is usually more straightforward to define them as MATLAB functions. That approach is documented on this page:

Coefficients defined with a function

For your equation, f could be defined as the string "x.^ux+(y-1).*uy" (without the "), a=-2, d=1, and c=0.

However, a strong caveat is in order. The algorithms in PDE Toolbox are designed for the case where the second-order c-term is significant relative to the first-order derivative terms. So the success for this equation will depend very much on the boundary and initial conditions. It might also be necessary to set c to some small number; this is sometimes referred to as adding "artificial diffusion."

$\endgroup$
5
  • $\begingroup$ Correct me if I'm wrong, from the PDE Form documentation, it looks like all equations types that can be solved by PDE toolbox involve only 2nd-order spatial derivatives but no 1st-order spatial derivatives. $\endgroup$
    – wdg
    Jul 23, 2014 at 16:53
  • $\begingroup$ Oh, sorry, I read your second sentence and didn't look as closely at your PDE as I should have. In PDE Toolbox, the coefficients, themselves, can be functions of first-order spatial derivatives of the dependent variables so you could include them in the f-coefficient. But you are correct that it is designed to handle PDE that have a significant diffusion term. $\endgroup$ Jul 23, 2014 at 18:49
  • $\begingroup$ How do I express, for example, f=$x\partial_xu$ in Matlab? $\endgroup$
    – wdg
    Jul 24, 2014 at 1:52
  • $\begingroup$ I updated my original response to cover this question and say a bit more about using PDE Toolbox for first-order equations. $\endgroup$ Jul 24, 2014 at 12:44
  • $\begingroup$ Indeed, PDE tool cannot solve the PDE when $c$=0. $\endgroup$
    – wdg
    Jul 25, 2014 at 1:05
1
$\begingroup$

I'm not familiar with this PDE toolbox in Matlab, but the software COMSOL Multiphysics is developed from this toolbox. You can dig a bit to find out their close relation. Also if you check out COMSOL you will find how these two look alike.

At least in COMSOL, I know your PDE is in principle possible to solve.

$\endgroup$
1
  • $\begingroup$ I'm happy to know such package but it looks like an overkill. $\endgroup$
    – wdg
    Jul 23, 2014 at 16:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.