帮忙看看matlab二分法程序哪里出错了?报错是:Error in erfenfa (line 6)ya=f(a);Output argument "c" (and maybe others) not assigned during call to "D:\ProgramFiles\MATLAB\R2011b\bin\erfenfa.m>erfenfa".function [c,delta]=erfenfa(f,a,b,er
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 01:16:10
帮忙看看matlab二分法程序哪里出错了?报错是:Error in erfenfa (line 6)ya=f(a);Output argument "c" (and maybe others) not assigned during call to "D:\ProgramFiles\MATLAB\R2011b\bin\erfenfa.m>erfenfa".function [c,delta]=erfenfa(f,a,b,er
帮忙看看matlab二分法程序哪里出错了?
报错是:Error in erfenfa (line 6)
ya=f(a);
Output argument "c" (and maybe others) not assigned during call to "D:\Program
Files\MATLAB\R2011b\bin\erfenfa.m>erfenfa".
function [c,delta]=erfenfa(f,a,b,error)
%function [c,delta]=erfenfa(f,a,b,error)
%a,b是求根区间左右端点,要求a0
disp('请重新选择求根区间')
return
end
max1=1+round(log(b-a)-log(error)/log(2));
for k=1:max1
c=(a+b)/2;
yc=feval(f,c);
if yc==0
a=c;
b=c;
else
if yb*yc>0
b=c;
yb=yc;
else
a=c;
ya=yc;
end
if b-a
帮忙看看matlab二分法程序哪里出错了?报错是:Error in erfenfa (line 6)ya=f(a);Output argument "c" (and maybe others) not assigned during call to "D:\ProgramFiles\MATLAB\R2011b\bin\erfenfa.m>erfenfa".function [c,delta]=erfenfa(f,a,b,er
% f是要求根的函数,f=inline('','');
ya=f(a)
可能输入的f不能用f(a)求函数值,换成feval(f,a);试试