自己结合help写的一个程序:
% fitmyfun.m
clc
clear
xdata=(0:0.1:1)';
ydata=(0.6).^xdata+2;
% Creat own fun
f=fittype('a.^x+b');
% fit
cfun=fit(xdata,ydata,f,'Startpoint',[0.1 0.1])
运行结果:
cfun =
General model:
cfun(x) = a.^x+b
Coefficients (with 95% confidence bounds):
a = 0.6 (0.6, 0.6)
b = 2 (2, 2)
我现在需要具体拟合的公式为[(1/a) ^ (k1*x) + (1/b) ^ (k2 * y) + c] * xy = z
我根据friendchj朋友提供的帮助我写了
f=fittype('(a.^(k1.*x)+b.^(k2.*y)+c).*x.*y','coefficients',{'a','b','c','k1','k2'},'independent',{'x','y'})
出错
??? Error using ==> fittype.fittype at 333
Independent variable xy does not appear in the equation expression.