Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

i encountered an error saying Undefined function 'Linda' for input arguments of type 'char', while trying save a file and run a code

조회 수: 1 (최근 30일)
Function Y = linda_77
N=100; % Total population size
en=50; % plot every enth time interval
T=zeros(N+1,N+1); % T is the transition matrix, defined below
v=linspace(0,N,N+1);
p=zeros(time+1,N+1);
p(1,3)=1; % Two individuals initially infected.
bt=beta*v.*(N-v)/N;
dt=(b+gama)*v;
for i=2:N % Define the transition matrix
T(i,i)=1-bt(i)-dt(i); % diagonal entries
T(i,i+1)=dt(i+1); % superdiagonal entries
T(i+1,i)=bt(i); % subdiagonal entries
end
T(1,1)=1;
T(1,2)=dt(2);
T(N+1,N+1)=1-dt(N+1);
for t=1:time
y=T*p(t,:);
p(t+1,:)=y;
end
pm(1,:)=p(1,:);
for t=1:time/en;
pm(t+1,:)=p(en*t,:);
end
ti=linspace(0,time,time/en+1);
st=linspace(0,N,N+1);
mesh(st,ti,pm);
xlabel(Number of Infectives);
ylabel(Time Steps);
zlabel(Probability);
view(140,30);
axis([0,N,0,time,0,1]);

답변 (1개)

Walter Roberson
Walter Roberson 2019년 6월 16일
MATLAB is case sensitive. That code would not be recognized as a function because you used Function instead of function
With that change made, this code would define a function named linda_77 . With the _77 that cannot match Linda even if you fixed the case sensitivity problem.
If you want this function to be invoked as Linda then you should change it to function Linda and store it in Linda.m

제품

Community Treasure Hunt

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

Start Hunting!

Translated by