Help: BVP4C warning error !!

4 ビュー (過去 30 日間)
Syaza Latif
Syaza Latif 2013 年 8 月 22 日
Hi there, I'm solving a bvp using bvp4c. There is a warning error which I do not understand at all. Can someone please explain what is about and how to solve this problem?
**Warning: Unable to meet the tolerance without using more than 1666 mesh points. The last mesh of 2000 points and the solution are available in the output argument. The maximum residual is 240.083, while requested accuracy is 0.001. **
Many thanks.
Syaza

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 8 月 22 日
  1 件のコメント
Syaza Latif
Syaza Latif 2013 年 9 月 3 日
編集済み: Syaza Latif 2013 年 9 月 3 日
Hi Walter,
I have tried increasing NMax and RelTol but I get the same error. Here is my code:
function mat4bvp_Model
clc
clear all
global beta gamma theta s0 Ri Di Rf Df
% %%~~R=y(1); D=y(2); E=y(3); lambda_R=y(4);lambda_D=y(5);lambda_E=y(6);
%%% the parameter values
beta= 0.7379; Ri=0.6118; Di=0.0164; gamma=0.2801; theta=0.05; s0=0.1;
%%% the pre-defined (fixed) end points for D
Df=0.3483;
options = bvpset('RelTol', 1e-4, 'AbsTol', 1e-4, 'NMax', 10000)
solinit = bvpinit(linspace(0,100),[Ri Di 1.0 0.1 1 0.1]);
sol = bvp4c(@mat4ode_Model,@mat4bc_Model,solinit,options)
t = linspace(0,100,1000);
y = deval(sol,t);
%% plotting the figures
figure(1)
plot(t,y(1,:))
figure(2)
plot(t,y(2,:))
figure(3)
plot(t,y(3,:))
figure(4)
plot(t,y(4,:))
figure(5)
plot(t,y(5,:))
figure(6)
plot(t,y(6,:))
end
%%-the boundary conditions---------------------------------------------------
function res=mat4bc_Model(ya,yb)
global Ri Di Df
res=[ya(1)-Ri
ya(2)-Di
yb(2)-Df
ya(3)
yb(4)
yb(6)];
end
%%---the ODEs--------------------------------------------------
function dydx=mat4ode_Model(t,y)
global beta gamma theta s0
% %%~~R=y(1); D=y(2); E=y(3); lambda_R=y(4);lambda_D=y(5);lambda_E=y(6);
dydx=[(y(3)-gamma*y(1))*(1-y(1)-y(2)) %% dR/dt
beta*y(2)*(1-y(1)-y(2)) %%dD/dt
-theta*y(3)+ s0*c(s0,y(6)) %%dE/dt
y(4)*(y(3)+gamma* (1-2*y(1)-y(2))) + beta*y(5)*y(2) %%dlambda_R/dt
y(4)*(y(3)-gamma*y(1))- y(5)*beta*(1-y(1)-2*y(2)) %%dlambda_D/dt
y(6)*theta - y(4)*(1-y(1)-y(2))]; %%dlambda_E/dt
end
function C=c(s0,y6)
C=-s0/2 * y6;
end

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBoundary Value Problems についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by