Solving Multi-variable Partial Differential Equation

boundary conditions;
Please help me to solve above differential eqation. I want P = P(x,y) and also generate a 3D plot for the same.
I am a new to MATLAB, any help shall be highly appreciated.
Thanks in advance.

 채택된 답변

Torsten
Torsten 2023년 10월 3일
편집: Torsten 2023년 10월 3일

1 개 추천

The only thing you can get with the "boundary condition" you gave is the solution on the characteristic curve of the PDE through (x0,y0).
Look up "method of characteristics" for more details.
And I don't understand why you write
I am a new to MATLAB, any help shall be highly appreciated.
It's not a MATLAB problem.

댓글 수: 6

Captain Rituraj Singh
Captain Rituraj Singh 2023년 10월 3일
편집: Captain Rituraj Singh 2023년 10월 3일
I wrote this because I don't know which MATLAB subroutine or function is suitable to solve such an equation. I want to write a MATLAB code for above equation but not certain where to start. I won't post anything here if it is not related to MATLAB.
Torsten
Torsten 2023년 10월 3일
편집: Torsten 2023년 10월 3일
Do you know how the method of characteristics works and how it is to be applied to your problem ?
If you understand this method, you will see that your problem is equivalent to solving three ordinary differential equations. The MATLAB solver to be used for this system is ode45.
I am not aware of "method of characteristics". But I have used ode45 earlier and sample program can help me better, though I fill try to look into "method of characteristics".
Thanks
Torsten
Torsten 2023년 10월 3일
편집: Torsten 2023년 10월 3일
Set x = x(t) and y = y(t) (x(t) and y(t) will describe the characteristic curve through (x0,y0)) and P = P(x(t),y(t)).
Then
dP/dt = dP/dx * dx/dt + dP/dy * dy/dt
So if you define the curve (x(t),y(t)) by
dx/dt = cosh(y) , x(0) = 0.1
dy/dt = -sinh(y)/x, y(0) = 0.1,
then
dP/dt = -P/(3*x), P(0) = P(x0,y0) = 0.5.
on this curve.
Summarizing: you get a solution for P on the curve (x(t),y(t)) by solving the three ordinary differential equations
dx/dt = cosh(y) , x(0) = 0.1,
dy/dt = -sinh(y)/x, y(0) = 0.1,
dP/dt = -P/(3*x), P(0) = P(x0,y0) = 0.5
More is not possible with the condition P(0.1,0.1) = 0.5.
It's like solving an initial value problem: Given the condition in only one point gives a 1d solution curve, not a 2d function P(x,y).
Do you see what I mean: it's not a problem with MATLAB ?
fun = @(t,u)[cosh(u(2));-sinh(u(2))/u(1);-u(3)/(3*u(1))];
u0 = [0.1;0.1;0.5];
tstart = -10;
tend = 10;
tspan1 = [0 tstart];
[T1,U1] = ode45(fun,tspan1,u0);
tspan2 = [0 tend];
[T2,U2] = ode45(fun,tspan2,u0);
T = [flipud(T1);T2(2:end)];
U = [flipud(U1);U2(2:end,:)];
plot3(U(:,1),U(:,2),U(:,3))
xlabel('x')
ylabel('y')
zlabel('P')
Thank you so much @Torsten, provided solution was very helpful.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by