what is the meaning of this error, "??? Undefined function or method 'Restart' for input arguments of type 'char' when using Matlab?

what is the meaning of this error, "??? Undefined function or method 'Restart' for input arguments of type 'char' when using Matlab?

6 Comments

What is the context? What is the code that creates the error, and what is the full text of the error message?
Without context, it means somewhere, some code is trying to call a function or method called "Restart" with a character vector as an argument. If it's supposed to be restart(), it shouldn't be capitalized.
Edit - fixed some apparent typos in the code
% The Matlab Codes for the forward bifurcation diagram
Rev_value=0.018:0.01:4;
Root_array=zeros (length (Rev_value), 2);
qI=0.001923; qA=0.00000004013; etaA=0.1213; etaQ=0.003808; w=0.5925;
Lambda=7898250;theta=0.022;
delta=0.125; mu=0.01119; pi=0.464360344; deltaQ=6.847e-4; beta=1.086e-1;
qE=1.8113e-4; rhoQ=0.0815; a=0.16255; k=0.15; v1=0.71; v2=0.29;alpha=0.57e-1; deltaI=0.00000000223; rhoA=0.1; rhoI=0.0666666;
c1=mu+v1; c2=1-w; c3=mu+alpha+v2; c4=1-k; c5=qE+delta+mu; c6=rhoA+mu; c7=delta*(1-a); c8=rhoI+qI+deltaI+mu; c9=rhoA+deltaQ+mu;
k1=delta*a*c8*c9+c7*k*qI*rhoQ+c8*k*qE*rhoQ; k2=c7*qI+c8*qE; b1=1-theta;
p2=(b1*c1*c2)*(a*c8*c9*delta*rhoA*pi+c4*c6*c7*qI*rhoQ*pi+c4*c6*c8*qE*rhoQ*pi+c8*k*qE*rhoA*rhoQ*pi+c7*k*qI*rhoA*rhoQ*pi)+(c2*c8*theta*v1*pi)*(c4*c6*qE*rhoQ+a*c9*delta*rhoA+k*qE*rhoA*rhoQ)+c2*c6*c7*c9*rhoI*theta*v1*pi+c3*c4*c6*c7*qI*rhoQ*theta*pi+c3*c7*k*qI*rhoA*rhoQ*theta*pi+(c3*c8)*(k*qE*rhoA*rhoQ*theta*pi+c4*c6*qE*rhoQ*theta*pi+a*c9*delta*rhoA*theta*pi)+b1*c4*c6*c7*qI*rhoQ*v2*pi+b1*c4*c6*c8*qE*rhoQ*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k2*pi+c2*c6*mu*k2*theta*pi+b1*c2*k1*pi*mu+c2*theta*k1*pi*mu+b1*c2*c6*c9*mu*c7*pi+c2*theta*c6*c9*mu*c7*pi+b1*c2*pi+c2*pi*theta;
H2=p2+G2;
H3=alpha*c5*c6*c8*c9*theta*v1*pi+(alpha*b1*c1*c5*c6*c8*c9*pi)*(1-U*Rev_value)+(c5*pi)*(b1*v2+c3*theta+b1*c1+v1*theta)-(c2*theta*v1*beta*etaA*pi*mu+c3*theta*beta*etaA*pi*mu)*(k1)-(c2*theta*v1*beta*pi*mu+c3*theta*beta*pi*mu)*(c6*c9*c7)-(k2)*(c2*theta*v1*pi*mu*c6+c3*theta*pi*mu*c6)*(beta*etaQ);
hold on
for i=1:1:length(Rev_value)
Rev=Rev_value(i);
% bifurcation parameter
%Coefficients of quadratic equation H1, H2, H3
p=[H1,H2,H3];
r =roots(p);
len=length(r);
for t=1:1:len
if (imag(r(t))~=0) || (real(r(t))<0)
Root_array(i,t)=0;
else
Root_array(i,t)=r(t);
end
end
end
f=1;
while (Root_array(f,1)==0 && Root_array(f,2)==0)
f=f+1;
end
Rev_value_Cr=f;
for j=Rev_value_Cr:1:length(Rev_value)
Root_array(j,:) =sort(Root_array(j,:));
end
f1=Rev_value_Cr;
while (Root_array(f1,1)~=0)
f1=f1+1;
end
Rev_value_Cr2=f1;
Zero_1st=Rev_value(1,1:Rev_value_Cr2-1);
y_zero=zeros(1,length(Zero_1st));
Unstable =Rev_value(1,Rev_value_Cr:length(Rev_value));
figure (1)
plot(Unstable, Root_array(Rev_value_Cr:length(Rev_value),2),'r','LineWidth',3)
figure (2)
plot(Unstable,Root_array(Rev_value_Cr:length(Rev_value),2),'b','LineWidth',3)
ylabel('Force of Infection,(\lambda)','FontSize',12)
xlabel('reproduction number, R_o','FontSize',12)
hold off
figure (3)
plot(Rev_value,Root_array(:,1),'r',Rev_value,Root_array(:,2),'r',Rev_value,Root_array(:,2),'b','LineWidth',4)
ylabel('Force of Infection, \lambda','FontSize',12)
xlabel('reproduction number, R_o','FontSize',12)
The code you have shared does not produce the error you are asking about.
This code is not ploting any graph as expected. Please what do you think is wrong?
It plots what you told it to plot. If you're plotting the wrong things, then probably your equations are wrong.

Sign in to comment.

Answers (1)

Hello ELISHA,
I tried running your commented code and found some different issue in your while loop.
Your code is running out of Root_array range, which is giving me error, you can stop that by checking width of Root_array as below
while (f<width(Root_array) && Root_array(f,1)==0 && Root_array(f,2)==0)
f=f+1;
end
while (f1<width(Root_array) && Root_array(f1,1)~=0)
f1=f1+1;
end
I also found that you are getting no plot in figure 1 and figure 2 because the plot inputs are empty (0×1 or 1×0 size)
Unstable =Rev_value(1,Rev_value_Cr:length(Rev_value))
unstable = 1×0 empty double row vector
Root_array(Rev_value_Cr:length(Rev_value),2)
Root_array = 0×1 empty double column vector
You can debug your code to fix these issues.

1 Comment

Sandeep Mishra,
Thank you for your input. I copied the code you sent and replaced mine but it didn't still work. Please find below my equations and necessary parameters. I am ploting bifurcation graph- "Force of infection" against the "basic reproduction no Rev".
Please help me plot this graph.
% The Matlab Codes for the forward bifurcation diagram
Rev_value=0.018:0.01:4;
Root_array=zeros (length (Rev_value), 2);
qI=0.001923; qA=0.00000004013; etaA=0.1213; etaQ=0.003808; w=0.5925;
Lambda=0.1598643e-7; theta=0.022;
delta=0.125; mu=0.01119; pi=0.464360344; deltaQ=6.847e-4; beta=1.086e-1;
qE=1.8113e-4; rhoQ=0.0815; a=0.16255; k=0.15; v1=0.71; v2=0.29;alpha=0.57e-1; deltaI=0.00000000223; rhoA=0.1; rhoI=0.0666666;
c1=mu+v1; c2=1-w; c3=mu+alpha+v2;c4=1-k; c5=qE+delta+mu; c6=rhoA+mu; c7=delta*(1-a); c8=rhoI+qI+deltaI+mu; c9=rhoA+deltaQ+mu;
b1=1-theta;
B=delta*a*c8*c9+c7*k*qI*rhoQ+c8*k*qE*rhoQ;
G=qI*c7*c6+qE*c8*c6;
H1=c2*c5*c6*c8*c9;
H2=c5*c6*c8*c9*(c3*+c1*c2)-(b1*c2+c2*theta)*(c6*c9*c7*pi*beta+pi*G*beta*etaQ+pi*B*beta*etaA);
H3=c5*c6*c8*c9*(c3*c1-v1*v2)*(1-b1*Rev_value)-(c3*theta+c2*v1*theta)*(c6*c9*c7*pi*beta+pi*G*beta*etaQ+pi*B*beta*etaA);
hold on
for i=1:1:length(Rev_value);
Rev=Rev_value(i);
% bifurcation parameter
%Coefficients of quadratic equation H1, H2, H3
p=[H1,H2,H3];
r =roots(p);
len=length(r);
for t=1:1:len

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Asked:

on 8 Jul 2023

Commented:

on 11 Jul 2023

Community Treasure Hunt

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

Start Hunting!