字典翻译 问答 其它 matlab拟合二个未知变量.已知A=x-10*y*lgB;其中A=[1,2,3,4,5,6,7,8,9,10];B=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1];求拟合的最优x和y值.
问题标题:
matlab拟合二个未知变量.已知A=x-10*y*lgB;其中A=[1,2,3,4,5,6,7,8,9,10];B=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1];求拟合的最优x和y值.
问题描述:

matlab拟合二个未知变量.已知A=x-10*y*lgB;

其中A=[1,2,3,4,5,6,7,8,9,10];B=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1];

求拟合的最优x和y值.

李燕萍回答:
  >>A=[1,2,3,4,5,6,7,8,9,10];B=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1];   >>fun=inline('x(1)-10*x(2)*log10(B)','x','B');%log10(B),10为底的常用对数   >>[x,resnorm,residual,exitflag]=lsqcurvefit(fun,[0.11],B,A)   Localminimumfound.   Optimizationcompletedbecausethesizeofthegradientislessthanthedefaultvalueofthefunctiontolerance.   x=   8.6137-0.9051   resnorm=   7.7829   residual=   Columns1through7   -1.43710.28750.88121.01200.88910.60580.2117   Columns8through10   -0.2634-0.8005-1.3863   exitflag=   1   %exitflag=1,最优解   拟合的最优x和y值:x=8.6137y=-0.9051
沈益民回答:
  您好,我的方法算的y和你的y差个负号,宁能帮忙看看哪里不对吗?最佳给您!clc;A=[1;2;3;4;5;6;7;8;9;10];B=[0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1];B=10*log10(B);X=[ones(10,1),B];[b,bint,r,rint,stats]=regress(A,X)fprintf('经验公式中的系数x,y分别为%f,%fn',b(1),b(2));经验公式中的系数x,y分别为8.613684,0.905078
李燕萍回答:
  用Matlab的工具箱,得到的结果与上面的的结果是一样的。Generalmodel:f(B)=a-10*b*log10(B)Coefficients(with95%confidencebounds):a=8.614(7.523,9.704)b=-0.9051(-1.143,-0.6669)Goodnessoffit:SSE:7.783R-square:0.9057AdjustedR-square:0.8939RMSE:0.9863
点击显示
其它推荐
热门其它推荐
  • 其它