Solving a first order Partial Differential Equation in MATLAB

I want to solve a first order partial differential equation of the form
(∂f(x,y))/∂x+(∂f(x,y))/∂y=g(x,y)
where g(x,y) is an image consisting of nx pixels in x direction and ny pixels in y direction (nx*ny pixels). I wanted to solve this PDE to obtain f(x,y). Can anyone suggest how to solve this PDE in MATLAB.
I had easily solved a second order PDE in MATLAB using finite difference method but I am not able solve the above first order PDE.
Thanks in advance…

3 件のコメント

John BG
John BG 2017 年 7 月 20 日
編集済み: John BG 2017 年 7 月 20 日
do you want a solution with the PDE toolbox?
or without such toolbox?
John BG
Huimin Liu
Huimin Liu 2018 年 2 月 22 日
Hello, have u solved this problem? what method did u use? could u be kind enough to give me some hints? cuz I have come across a same problem like u。。。。
Huimin Liu
Huimin Liu 2018 年 2 月 22 日
did u use pdepe?

サインインしてコメントする。

 採用された回答

ASHIK A S
ASHIK A S 2018 年 2 月 22 日

0 投票

Hi...
I have solved the problem..
I custom made a solver using Finite Difference Method and adopted it to solve the PDE. In situations like the one I mentioned above, Finite difference method is the best choice according to me
-Regards Ashik

その他の回答 (3 件)

Huimin Liu
Huimin Liu 2018 年 3 月 6 日

0 投票

Thank you for your answer.... I have been learning FDE method these days according to your advice. Still, I have a few questions, could you give me more details about this method? 1、did you set any boundary conditions? I have to set a Neumann boundary condition with the form as follow: and I’m now puzzled in how to set the Neumann boundary condition to the sparse matrix, I have found severl examples with boundary condition like Dirichlet boundary condition on the Internet, but I still don't know how to set the Neumann boundary condition which restricts the exterior normal of the unknown function. Do you know how to solve this problem? 2、what value did you set to the interval h? is h=1 suitable for the results? 3、could you show me your code in solving this problem if it's ok with you? I'm a student in this field, and now is a freshman, could I have your code for further learning?
Huimin Liu
Huimin Liu 2018 年 3 月 6 日

0 投票

the Neumann boundary condition is like

3 件のコメント

Torsten
Torsten 2018 年 3 月 6 日
Neumann boundary conditions for 1st order PDEs are not allowed, only Dirichlet conditions. (The maximum order of the boundary conditions is "order of the PDE - 1").
Best wishes
Torsten.
Huimin Liu
Huimin Liu 2018 年 3 月 6 日
really? I'm wondering that the Neumann boundary condition is a ZERO-Neumann boundary condition....so is there any possibility to set the boundary condition?
Torsten
Torsten 2018 年 3 月 7 日
Whether zero or not - first-order boundary conditions are not allowed for first-order PDEs.
Best wishes
Torsten.

サインインしてコメントする。

BRINDHA
BRINDHA 2023 年 9 月 11 日

0 投票

How to solve a first order partial differential equation of the form
(∂p(t,a))/∂t+(∂p(t,a))/∂a= -0.09 p(t,a) in MATLAB, here P is a predator.

1 件のコメント

Torsten
Torsten 2023 年 9 月 11 日
Use backward differencing to discretize dp/da in space.
This will give you a system of ordinary differential equations for p in the grid points.
Use ode15s to solve it.
Look up "method-of-lines" for more details.

サインインしてコメントする。

製品

質問済み:

2017 年 7 月 20 日

コメント済み:

2023 年 9 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by