📄 expfitxy.m
字号:
function estimates=expfitxy(x,y)
%input x is 1-by-N vector
% y is 1-by-N vector
%output a is the coeficient of fitting formula y=a*exp(bx)
model=@expxy;
[estimates]=fminsearch(model,rand(1,2));
%define the function of condition for fitting formula
function f=expxy(params)
n=length(x);
f=0;
f1=@(x1) params(1)*exp(params(2)*x1);
for i=1:n
f=f+(f1(x(i))-y(i))^2;
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -