Spatial discretization has failed

m = 0;
x = 0:0.5:5; %linspace x
t = 0:0.5:100; %linspace t
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t); %solver
A = sol(:,:,1);
H = sol(:,:,2);
figure
surf(x,t,A)
title('A(x,t)')
xlabel('Distance x')
ylabel('Time t')
figure
surf(x,t,H)
title('H(x,t)')
xlabel('Distance x')
ylabel('Time t')
-----------------
function [c,f,s] = pdex4pde(x,t,u,DuDx)
R=25;
Q=2.5;
P=56.25;
c = [1; 1];
f = [1; P] .* DuDx;
s = [1+u(1)^2/u(2)-u(1); Q*(u(1)^2-u(2))];
-----------------------------------------
function [Al,Hl,Ar,Hr] = pdex4bc(xl,ul,xr,ur,t)
Al = [0; ul(1)];
Hl = [0; ul(2)];
Ar = [0; ur(1)];
Hr = [0; ur(2)];
----------------
function u0 = pdex4ic(x);
u0 = [13; 338];
I got this message:
Error using pdepe (line 293)
Spatial discretization has failed. Discretization supports only
parabolic and elliptic equations, with flux term involving spatial
derivative.
Error in testp2 (line 4)
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t); %solver

Answers (1)

Torsten
Torsten on 10 Dec 2015
You only set two (strange) boundary conditions instead of four required by the solver.
What are your boundary conditions in mathematical notation ?
Best wishes
Torsten.

Asked:

on 10 Dec 2015

Edited:

on 10 Dec 2015

Community Treasure Hunt

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

Start Hunting!