%内置M文件
function z = testfun(a,b,c)
z=(factorial(b)/(factorial(a)*factorial(b-a)))*(c^a)*((1-c)^(b-a));
end
程序:
clc;clear;syms x y %横坐标x,纵坐标yN=20;M=5;
A=N*y*testfun(M-1,N-1,x);
g=1;
for i=0:M-1
g=g+(i/M-1)*testfun(i,N,x);
end
fun=A-g;
ezplot(fun,[0,1,0,16]);
hold on
为什么运行不起??????显示错误如下:???
Error using ==> contourcInput matrix contains no finite values - unable to calculate contours
Error in ==> contours at 57CS=contourc(varargin{numarg_for_call});
Error in ==> contour3 at 87[c,msg] = contours(args{1:nin});
Error in ==> contour>Lcontourv6 at 112 [c,h,msg] = contour3(cax,args{:});
Error in ==> contour at 67 [c,h] = Lcontourv6(args{:});
Error in ==> ezplot>ezimplicit at 305 [cmatrix,hp] = contour('v6',cax,X(1,:),Y(:,1),u,[0,0],'-'); %#ok
Error in ==> ezplot at 153 hp = ezimplicit(cax,f{1},vars,labels,args{:});
Error in ==> sym.ezplot at 53 h = ezplot(char(f),[y(1) y(2)],[y(3) y(4)]);
clc;clear;
syms x y %x横轴,y纵轴
N=20;
M=5;
A=N*y*testfun(M-1,N-1,x);
g=1;
for i=0:M-1
g=g+(i/M-1)*testfun(i,N,x);
end
fun=(A-g);
ezplot(fun,[0,1,0,16]);
hold on