|
楼主 |
发表于 2006-3-25 19:21
|
显示全部楼层
<P>谢谢happy!<BR>上面那个函数拟和后的结果差别挺大的,然后我换了一种方法,因为考虑的原来的函数涉及参数太多,现在我直接把传递函数中的未知的参数作为未知量,这样就有四个未知参数,分别是x(1)、x(2)、x(3)、x(4),函数还是上面那个函数,在Matlab里写成下面的形式:<BR><BR>-----------------------------------------------------------------------------------<BR>>> x0=[10.5 13 10.8 3.7];<BR>>> nihe=inline('abs((x(1).*x(2))./(0.6511104*0.31197181e-6.*(i*aa).^3+400*0.311971818e-6.*(i*aa).^2+0.6511104*x(3).*(i*aa)+(x(3)-x(4))*400))','x','aa');<BR>>> [x,resid]=lsqcurvefit(nihhh,x0,w,b)<BR>-----------------------------------------------------------------------------------<BR>运行的结果是:<BR><BR>-----------------------------------------------------------------------<BR>Optimization terminated: first-order optimality less than OPTIONS.TolFun,<BR> and no negative/zero curvature detected in trust region model.</P>
<P>x =</P>
<P> 10.16912642549034 12.09428502203738 10.12954486552832 3.60115723265321</P>
<P><BR>resid =</P>
<P> 0.00471023030471<BR>------------------------------------------------------------------------------<BR>这次拟和之后,系统地Bode图和实验得到的图基本形状挺相似了。但是还是有些差别。<BR>根据上面那个resid = 0.00471023030471,应该是精度不高。我参照了薛定宇的书,修改精度限制,运行:<BR><BR>----------------------------<BR>f=optimset; f.TolFun=1e-5;<BR><BR>>> [x,resid]=lsqcurvefit(nihhh,x0,w,b,[],[],f)<BR>Optimization terminated: first-order optimality less than OPTIONS.TolFun,<BR> and no negative/zero curvature detected in trust region model.</P>
<P>x =</P>
<P> 10.59473781945222 13.57022868708455 11.70048598360950 4.03621143050545</P>
<P><BR>resid =</P>
<P> 0.00471017851879<BR>----------------------------<BR>但是精度并没有提高,请问如何才能使拟和的精度更好一些?<BR><BR></P> |
|