Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#3 |
初级会员
注册日期: 2008-09-28
年龄: 36
帖子: 4
声望力: 0 ![]() |
![]()
那个function文件里面的变量是不能在其他的函数段里面用的,它就仅仅是一个代号,没有实际意义的;你可以运行你那个function文件,结果出来肯定不是jrl=……,而是ans=……
你可以将画图的函数段也集成到function函数中去,直接对数组作用,画出图像。 fuction Jr_l(eps) J = zeros(size(eps)); if length(eps)>1 error('epsilon must be s scale,not a vector!'); if eps>1 Fai_L=pi; else Fai_L = acos(1-2*eps); %积分限。 end syms f int_f = ((1-(1-cos(f))/(2*eps))^(1.1))*cos(f)/(2*pi); %被积函数 jrl =double(int(int_f,f,-Fai_L,Fai_L)); %积分 jrl=real(jrl); plot(eps,J); hold on; end hold off; xlabel 'eps' ylabel 'Jr' end |
![]() |
![]() |