![]() |
Solution of the Poisson equation
uxx + uyy = 1 with boundary condition u = 0on a domain which has the shape of Maryland (triangles show the mesh which was used for computation with the finite element method) |
heat_pwlin([-1 0 1],[0 1 0],0:.02:1);
U(x,t) = g(t-1/2x)We found that
g(x) = ½·π-1/2·∫0xexp(-p2/4)dp + ½ = ½·erf(x/2) + ½The "error function" erf(x) is defined as π-1/2·∫0xexp(-p2)dp, this function is available in Matlab and many other programming languages. In Matlab we can plot the solution U(x,t) for x∈[-5,5], t∈[0,2] as follows:
[X,T]=ndgrid(-5:.1:5,0:.1:2); U = erf(T.^-.5.*X/2)/2 + 1/2; colorcurves(X,T,U);
ut - x·ux = u, u(x,0) = exp(-x2).Here c(x,t,u)=-x, f(x,t,u)=u, u0(x)=exp(-x2). We use for x0 the values -3,-2.9,...,2.9,3. We want to find the solution u(x,t) for 0≤t≤1 so we use t-values 0,.1,...,.9,1:
c = @(x,t,u) -x; f = @(x,t,u) u; u0 = @(x) exp(-x^2);This generates a graph of the characteristics, and a graph of the solution which you can rotate with the mouse.
[X,v] = quasilin(c,f,u0,-3:.1:3,0:.1:1);