graphing my first PDE

조회 수: 2 (최근 30일)
Rushan
Rushan 2014년 9월 19일
답변: Rushan 2014년 9월 19일
Hello! I am new to Matlab and trying to graph my first PDE. I have no idea how it works, can any one help me with how to write the script for the following PDE
c(∂u∂x) + ∂u∂t = 0 with initial condition u(x, 0) = arctan(x). Plot the solution to this PDE for a few different values of c (small, large, positive, negative)
Thanks :)

채택된 답변

Rushan
Rushan 2014년 9월 19일
how do find the correct boundary conditions when (initial condition) uo = atan(x) and the PDE equation is c(∂u∂x) + ∂u∂t = 0 ?

추가 답변 (1개)

David Sanchez
David Sanchez 2014년 9월 19일
take a look at the documentation.
doc pdepe
will present a very good example. This same example is explained in more detail in the following link:
You can easily adapt that example to solve your problem
  댓글 수: 1
Rushan
Rushan 2014년 9월 19일
thanks for the link. I tried writing the script for the equation, but i'm getting an error :(
PDE equation: c(∂u∂x) + ∂u∂t = 0
PDE equation in MATLAB format: 1/-c (DuDt) = x^-0 (x^0 DuDx) + 0 (not sure if its correct)
Here is my script: ---------------------------------------------------------------------------
function [c,f,s] = pdex1pde(x,t,u,DuDx)
c = -1;
f = DuDx;
s = 0;
function u0 = pdex1ic(x)
u0 = arctan(x);
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = ul;
ql = 0;
pr = 5;
qr = 1;
m = 0;
x = linspace(0,1,20);
t = linspace(0,2,5);
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
u = sol(:,:,1);
surf(x,t,u)
title('Numerical solution computed with 20 mesh points')
xlabel('Distance x')
ylabel('Time t')
---------------------------------------------------------------------------
Please Help me out !!! :(

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

카테고리

Help CenterFile Exchange에서 PDE Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by