matlab?Input argument "a" is undefined.执行如下程序:function U=forwdif(f,c1,c2,a,b,c,n,m)x=0:0.2:1;h=a/(n-1);k=b/(m-1);r=c^2*k/h^2;s=1-2*r;U=zeros(n,m);U(1,1:m)=c1;U(n,1:m)=c2;U(2:n-1,1)=feval(f,h:h:(n-2)*h)';for j=2:mfor i=2:n-1U(i,j)=s*U(i,
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/29 14:09:16
matlab?Input argument "a" is undefined.执行如下程序:function U=forwdif(f,c1,c2,a,b,c,n,m)x=0:0.2:1;h=a/(n-1);k=b/(m-1);r=c^2*k/h^2;s=1-2*r;U=zeros(n,m);U(1,1:m)=c1;U(n,1:m)=c2;U(2:n-1,1)=feval(f,h:h:(n-2)*h)';for j=2:mfor i=2:n-1U(i,j)=s*U(i,
matlab?Input argument "a" is undefined.
执行如下程序:
function U=forwdif(f,c1,c2,a,b,c,n,m)
x=0:0.2:1;
h=a/(n-1);
k=b/(m-1);
r=c^2*k/h^2;
s=1-2*r;
U=zeros(n,m);
U(1,1:m)=c1;
U(n,1:m)=c2;
U(2:n-1,1)=feval(f,h:h:(n-2)*h)';
for j=2:m
for i=2:n-1
U(i,j)=s*U(i,j-1)+r*(U(i-1,j-1)+U(i+1,j-1));
end
end
U=U';
报错 :
Input argument "a" is undefined.
Error in ==> forwdif at 3
h=a/(n-1);
matlab?Input argument "a" is undefined.执行如下程序:function U=forwdif(f,c1,c2,a,b,c,n,m)x=0:0.2:1;h=a/(n-1);k=b/(m-1);r=c^2*k/h^2;s=1-2*r;U=zeros(n,m);U(1,1:m)=c1;U(n,1:m)=c2;U(2:n-1,1)=feval(f,h:h:(n-2)*h)';for j=2:mfor i=2:n-1U(i,j)=s*U(i,
U=forwdif(f,c1,c2,a,b,c,n,m)
输入 a没定义.你看看参数a 传递了没有.在主程序里看.
这个是子函数.通过上面这个语句传入子函数,
在主程序里检查 forwdif(f,c1,c2,a,b,c,n,m) 中的 a