这个程序为何不通啊?
我做了一个程序,在调用子程序时老是出错,这个子程序我在其他的程序里调用,只是形式有些变化,总是不通,不知为何,请高手指点:主程序:function =int1xiao(alpha,beta)
EM=0;
m=3;
for ii=1:8
p=ii-1;
EM1=((-1)^p+(-1)^(m+p))*(alpha)^(2*p)/(((m+2*p+1)*factorial(2*p)*2^(2*p)));
FM=0;
for jj=1:ii
k=jj-1;
Jmk1=shuzhijifen(2*p-2*k,beta);
Jmk2=shuzhijifen(-2*k+2*p,beta);
Jmk3=shuzhijifen(0,beta);
JM=Jmk1+Jmk2-(factorial(2*p)/(factorial(p)^2))*Jmk3;
FM1=(-1)^(p-k)*factorial(2*p)/(factorial(k)*factorial(2*p-k))*JM;
FM=FM+FM1;
end
EM=EM+EM1*FM
end
子程序:
function y=shuzhijifen(n,k)
function f=f(y)
f=((i)^n/pi)*exp(i*k*cos(y)*cos(k*y));
end
y=quadl(@f,0,pi);
end
下面是报的错误信息:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> shuzhijifen>f at 5
f=((i)^n/pi)*exp(i*k*cos(y)*cos(k*y));
Error in ==> quadl at 64
y = feval(f,x,varargin{:}); y = y(:).';
Error in ==> shuzhijifen at 7
y=quadl(@f,0,pi);
Error in ==> int1xiao at 19
Jmk1=shuzhijifen(2*p-2*k,beta);
谢谢了! 注意*和.*的区别
页:
[1]