|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
<P>程序如下:<BR>function kIntegration</P>
<P>clear all<BR>clc</P>
<P>me=9.10956e-31;kb=1.38062e-23;ne=1.60219e-19;<BR>T=2;<BR>% the interval: [a, b], the step: d<BR>a = 11; % 积分下限<BR>b = 41.19; % 积分上限<BR>d = (b-a)/1000; </P>
<P>% 自适应Lobatto求积法(Adaptive Lobatto quadrature, high order)<BR>y_quadl = quadl(@func,a,b,T);<BR>k=((8*ne/(pi*me))^(1/2))*((T)^(-3/2))*y_quadl*(1e-6)*(6.02217e+23);<BR>disp('Results:')<BR>disp(' y_quadl k')<BR>disp([y_quadl,k])<BR>% ------------------------------------------------------------------<BR>function y = func(x,T) <BR>A4=-3E-23;A3=5E-21;A2=-2E-19;A1=6E-18;A0=-4E-17;<BR>y=x.*(A4.*(x.^4)+A3.*(x.^3)+A2.*(x.^2)+A1.*x+A0).*exp((-3/2)*x./T);<BR><BR>运行结果如下:<BR>??? Input argument "T" is undefined.<BR><BR>Error in ==> kIntegration1b>func at 23<BR>y=x.*(A4.*(x.^4)+A3.*(x.^3)+A2.*(x.^2)+A1.*x+A0).*exp((-3/2)*x./T);<BR>Error in ==> quadl at 64<BR>y = feval(f,x,varargin{:}); y = y(:).';<BR><BR>Error in ==> kIntegration1b at 15<BR>y_quadl = quadl(@func,a,b,T);<BR>为什么?</P> |
|