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值.
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 21:02:27
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.1 1],B,A)
Local minimum found.
Optimization completed because the size of the gradient is less thanthe default value of the function tolerance.
x =
8.6137 -0.9051
resnorm =
7.7829
residual =
Columns 1 through 7
-1.4371 0.2875 0.8812 1.0120 0.8891 0.6058 0.2117
Columns 8 through 10
-0.2634 -0.8005 -1.3863
exitflag =
1
%exitflag =1,最优解
拟合的最优x和y值:x= 8.6137 y=-0.9051