有一组数据:
P:0 0.001 0.002 0.003 0.004 0.005 0.006 0.008 0.011 0.014 0.019 0.023 0.03 0.037 0.048 0.06 0.08 0.1 0.136 0.17 0.217 0.279 0.388 0.444
c: 0 0.307598804 0.538975997 0.777628765 0.959350561 1.069744162 1.190592446 1.340828541 1.512368753 1.643259589 1.769609554 1.903576465 2.027165658 2.151392907 2.294367083 2.425558327
2.598588163 2.723808495 2.912380082 3.049909679 3.206076964
3.386393547 3.644346885 3.758352826
想用方程
$$P=(C-P / H)^{*}\left(10^{\wedge}(A(C-P / H)+B)\right)$$
P=(c-P/H)*(10^(A(c-P/H)+B))进行拟合,求出参数H,A和B。由于这是个隐函数,用origin拟合不了,据说可以用matlab用最小二乘法进行非线性拟合,可是我不会。哪位大牛能帮忙把程序写一下?我想看看这个方程对实验数据的拟合效果好不好,要是效果还行的话我就去详细学一下matlab。非常感谢!上面是小木虫的求助下面是我的应助:
clear,clc
p=[0 0.001 0.002 0.003 0.004 0.005 0.006 0.008 0.011 0.014 0.019 0.023 0.03 0.037 0.048 0.06 0.08 0.1 0.136 0.17 0.217 0.279 0.388 0.444];
c=[0 0.307598804 0.538975997 0.777628765 0.959350561 1.069744162 1.190592446 1.340828541 1.512368753 1.643259589 1.769609554 1.903576465 2.027165658 2.151392907 2.294367083 2.425558327 2.598588163 2.723808495 2.912380082 3.049909679 3.206076964 3.386393547 3.644346885 3.758352826];
cc=c';
pp=p';
F=@(q,x)(x(:,1)-x(:,2)/q(1)).*(10.^(q(2)*(x(:,1)-x(:,2)/q(1)))+q(3))-x(:,2);
x=[cc pp];
q0=[1 1 1];
warning off
q=nlinfit(x,zeros(size(x,1),1),F,q0);
disp('H A B分别为')
disp(num2str(q));
plot(x(:,1),x(:,2),'r^');hold on;
ezplot(@(x,y)F(q,[x,y]),[0,3.8,-0.1,0.5]);