Error detected but matlab did not specify the type of error. pls help out

2 views (last 30 days)
function y = conjunctivitis
test = -1;
tf=10;
delta = 0.001;
M = 50;
t = linspace(0,tf,M+1);
h = tf/M;
h2 = h/2;
Mh=0.639;
beta1=0.11;
beta2=0.112;
Nh=5000;
muh=0.469;
sigmah=0.123;
u1=.72;
delta1=0.213;
Mb=0.91;
Nb=7000;
beta3=.561;
beta4=.210;
mub=0.11;
H1=0.1;
H2=0.2;
H3=0.3;
M1=0.4;
M2=0.5;
M3=0.6;
M4=0.7;
x1=zeros(1,M+1);
x2=zeros(1,M+1);
x3=zeros(1,M+1);
x4=zeros(1,M+1);
x5=zeros(1,M+1);
x6=zeros(1,M+1);
c1 = zeros(1,M+1); c2 = zeros(1,M+1); c3 = zeros(1,M+1); c4 = zeros(1,M+1);
lambda1 = zeros(1,M+1);
lambda2 = zeros(1,M+1);
lambda3 = zeros(1,M+1);
lambda4 = zeros(1,M+1);
lambda5 = zeros(1,M+1);
lambda6 = zeros(1,M+1);
x1(1) = 20;
x2(1) = 20;
x3(1) = 20;
x4(1) = 20;
x5(1) = 5;
x6(1) = 10;
while(test < 0)
oldc1 = c1;
oldc2 = c2;
oldc3 = c3;
oldc4 = c4;
oldx1 = x1;
oldx2 = x2;
oldx3 = x3;
oldx4 = x4;
oldx5 = x5;
oldx6 = x6;
oldlambda1 = lambda1;
oldlambda2 = lambda2;
oldlambda3 = lambda3;
oldlambda4 = lambda4;
oldlambda5 = lambda5;
oldlambda6 = lambda6;
for i = 1:M
%for i = 1:M
m11 = Mh-((1-c1(i)).*beta1+(1-c2(i)).*beta2).*(x1(i).*x6(i))/(Nh)-muh.*x1(i)+sigmah.*c3(i).*x4(i);
m12 = ((1-c1(i)).*beta1.*x1(i).*x6(i))/(Nh)-muh.*x2(i)-(u1.*x2(i))/(1+x2(i));
m13 = ((1-c2(i)).*beta2.*x1(i).*x6(i))/(Nh)-(muh+delta1).*x3(i)-(u1.*x3(i))/(1+x3(i));
m14 = (u1.*x2(i))/(1+x2(i))+(u1.*x3(i))/(1+x3(i))-(muh+c3(i).*sigmah).*x4(i);
m15 = Mb.*Nb(1-c4(i))-(((1-c1(i)).*beta1.*x2(i)+(1-c2(i)).*beta2.*x3(i)).*x6(i))/Nb-c4(i).*mub.*x5(i);
m16 =(((1-c1(i)).*beta1.*x2(i)+(1-c2(i)).*beta2.*x3(i)).*x6(i))/Nb-c4(i).*mub.*x6(i);
m21 = Mh-((1-(0.5.*(c1(i)+c1(i+1))).*beta1+(1-(0.5.*(c2(i)+c2(i+1))).*beta2))).*(x1(i)+h2.*m11).*(x6(i)+h2.*m16)/(Nh)-muh.*x1(i)+sigmah.*c3(i).*x4(i);
m22 = ((1-(0.5.*(c1(i)+c2(i+1)).*beta1.*(x1(i)+h2.*m11).*(x6(i)+h2.*m16))))/((Nh)-muh.*(x2(i)+h2.*m12))-(u1.*(x2(i)+h2.*m12))/(1+(x2(i)+h2.*m12));
m23 = ((1-(0.5.*(c2(i)+c2(i+1)).*beta1.*(x1(i)+h2.*m11).*(x6(i)+h2.*m16))))/(Nh)-(muh+delta1).*(x3(i)+h2.*m13)-(u1.*(x3(i)+h2.*m13))/(1+(x3(i)+h2.*m13));
m24 = (u1.*(x2(i)+h2.*m12))/(1+(x2(i)+h2.*m12))+(u1.*(x3(i)+h2.*m13))/(1+(x3(i)+h2.*m13))-(muh+c3(i).*sigmah).*(x4(i)+h2.*m14);
m25 = Mb.*Nb(1-(0.5.*(c4(i)+c4(i+1))))-((1-(0.5.*(c1(i)+c1(i+1)))).*beta1.*(x2(i)+h2.*m12)+(1-c2(i)+c2(i+1)).*beta2.*(x3(i)+h2.*h13).*(x6(i)+h2.*m16))/Nb-c4(i).*mub.*x5(i);
m26 =(1-(0.5.*(c1(i)+c1(i+1))).*beta1.*(x2(i)+h2.*m12)+(1-(0.5.*(c2(i)+c2(i+1)).*beta2.*(x3(i)+h2.*m13).*(x6(i)+h2.*m16))))/Nb-((1-(0.5.*(c4(i)+c4(i+1)).*mub.*(x6(i)+h2.*h16))));
  2 Comments
Steven Lord
Steven Lord on 25 May 2020
What is the full and exact text (all the text displayed in red) of the error message you receive when you run this code? Don't summarize or paraphrase, just copy it verbatim from the Command Window into a comment.
oluwatayo ogunmiloro
oluwatayo ogunmiloro on 25 May 2020
@Steven Lord That is the error i ecountered below.
Error in conjunctivitis (line 89)
m25 =
Mb.*Nb(1-(0.5.*(c4(i)+c4(i+1))))-((1-(0.5.*(c1(i)+c1(i+1)))).*beta1.*(x2(i)+h2.*m12)+(1-c2(i)+c2(i+1)).*beta2.*(x3(i)+h2.*h13).*(x6(i)+h2.*m16))/Nb-c4(i).*mub.*x5(i);
>>

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 25 May 2020
m25 = Mb.*Nb(1-(0.5.*(c4(i)+c4(i+1))))-((1-(0.5.*(c1(i)+c1(i+1)))).*beta1.*(x2(i)+h2.*m12)+(1-c2(i)+c2(i+1)).*beta2.*(x3(i)+h2.*h13).*(x6(i)+h2.*m16))/Nb-c4(i).*mub.*x5(i);
MATLAB does not have implied multiplication so Nb(expression) is a request to index the scalar Nb.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products


Release

R2014a

Community Treasure Hunt

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

Start Hunting!