why the code is not running?

조회 수: 2 (최근 30일)
MINATI
MINATI 2018년 12월 20일
편집: madhan ravi 2018년 12월 28일
m = 0;
x = linspace(0,1,41);
t = linspace(0,200,10);
sol = pdepe(m,@pdex5pde,@pdex5ic,@pdex5bc,x,t);
n = sol(:,:,1);
c = sol(:,:,2);
figure;
surf(x,t,c);
title('Distribution of fibronectin--c(x)');
xlabel('Distance x');
ylabel('Time t');
figure;
surf(x,t,n);
title('Distribution of ECs--n(x)');
xlabel('Distance x');
ylabel('Time t');
figure;
plot(x,n(end,:));
title('Final distribution of n(x).');
figure;
plot(x,c(end,:));
title('Final distribution of c(x).');
% --------------------------------------------------------------------------
function [c,f,s] = pdex5pde(x,t,u,DuDx)
d = 1e-3;
a = 3.8;
S = 3;
r = 0.88;
N = 1;
c = [1; 1];
f = [ d*DuDx(1) - a*u(1)*DuDx(2)
DuDx(2) ];
s1 = S*r*u(1)*(N - u(1));
s2 = S*(u(1)/(u(1) + 1) - u(2));
s = [s1; s2];
% --------------------------------------------------------------------------
function u0 = pdex5ic(x)
u0 = [1; 0.5];
if x >= 0.3 & x <= 0.6
u0(1) = 1.05 * u0(1);
u0(2) = 1.0005 * u0(2);
end
  댓글 수: 13
MINATI
MINATI 2018년 12월 28일
2016b
Walter Roberson
Walter Roberson 2018년 12월 28일
편집: Walter Roberson 2018년 12월 28일
What shows up for
which -all pdepe
I have tried the example in R2016b, and I tried your code (along with a copy of pdex4bc renamed pdex5bc) in R2016b, and I do not get any problem about too many input arguments for pdepe. I do get the error that Cris mentioned: with that boundary condition, your sol comes out 1 x 41 and you cannot surf() a vector.
You should post the pdex5bc that you are using.

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

채택된 답변

Cris LaPierre
Cris LaPierre 2018년 12월 20일
편집: Cris LaPierre 2018년 12월 25일
The pdex4 variable sol is a 9x13x2, or length(t) x length(x) x 2. The provided code (pdex5?) is 1x41x2. I don't understand your equations, but it looks like your code can't get past the t=0 step.
Can you double check that there is a solution at t=0?
It's worth verifying that your equations have been correctly entered as well.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by