why do i receive this error please help to rectify the error.

조회 수: 2 (최근 30일)
Mallikarjuna M
Mallikarjuna M 2022년 8월 11일
이동: Sabin 2023년 5월 18일
the boundary conditions are
a'(0)=0 a(1)=1
b(0)=0 b(1)=0
function steady
m = 0;
x = linspace(0,1);
t = linspace(0,10000);
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2= sol(:,:,2);
%figure
plot(x, u2(end,:),'m')
hold on
%title('u1(x, t)')
%xlabel('Distance x')
%ylabel('u1(x,t)')
%figure
% --------------------------------------------------------------
function [c,f,s] = pdex4pde(~,~,u,DuDx)
phi=0.001;ks=1;kp=1;al=0.1; %These parameter values are used in Fig.2
c = [1;1];
f = [1;1].* DuDx;
F1=phi.^2.*u(1)./(1+(u(2)./kp)+u(1).*(1+(u(1)./ks)));
F2=-al.*phi.^2.*u(1)./(1+(u(2)./kp)+u(1).*(1+(u(1)./ks)));
s = [F1;F2];
% --------------------------------------------------------------
function u0 = pdex4ic(~)
u0 = [1; 1];
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(~,~,ul,ur,~)
pl = [0;ul(2)];
ql = [1;0];
pr = [ur(1)-1;ur(2)];
qr = [0;0];
%qr = [0; bi*(1-ur(2))];
Error
Index exceeds the number of array elements (1).
Error in steady>pdex4bc (line 28)
pl = [0;ul(2)];
Error in pdepe (line 250)
[pL,qL,pR,qR] = feval(bc,xmesh(1),y0(:,1),xmesh(nx),y0(:,nx),t(1),varargin{:});
Error in steady (line 5)
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);

답변 (1개)

Walter Roberson
Walter Roberson 2022년 8월 11일
이동: Sabin 2023년 5월 18일
function [pl,ql,pr,qr] = pdex4bc(~,~,ul,ur,~)
ul is passed as the second parameter to pdex4bc, not the third entry.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by