graphing my first PDE

2 Ansichten (letzte 30 Tage)
Rushan am 19 Sep. 2014
Beantwortet: Rushan am 19 Sep. 2014
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 :)

Akzeptierte Antwort

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

Weitere Antworten (1)

David Sanchez
David Sanchez am 19 Sep. 2014
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 Kommentar
Rushan am 19 Sep. 2014
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);
title('Numerical solution computed with 20 mesh points')
xlabel('Distance x')
ylabel('Time t')
Please Help me out !!! :(

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by