Matlab 版 (精华区)
发信人: zjliu (秋天的萝卜), 信区: Matlab
标 题: Re: 多自变量的非线性拟合
发信站: 哈工大紫丁香 (Sun Jun 13 11:08:14 2004), 转信
看看这段程序,该程序不一定可靠,你再检查一下,我试了每次结果都不一样
function zhangsy
% 多自变量的非线性拟合
x=[313.15 318.15 323.15 323.15 328.15 328.15 333.15 333.15...
333.15 338.15 338.15 338.15 343.15 343.15 343.15];
v=[0.618,0.641,0.763,1.066,0.718,1.150,0.592,1.175,1.475,...
0.620,1.092,1.289,0.570,1.462,2.037];
y=[151.3 160.2 192.3 261.4 185.3 286.4 157.3 298.0 365.5...
167.3 284.2 332.2 156.9 378.9 507.4];
xdata=1:15;
% 拟合公式:
% y=R*x./(v-a(2))-a(1).*(1+(1-x./456.86).*(a(3)+a(4).*456.86./x))./(v.
*(v+a(2)))
ydata=y;
x0=rand(1,4);
x = lsqcurvefit(@myfun, x0, xdata, ydata)
function F = myfun(x,xdata)
F=100*xfun(xdata)./(vfun(xdata)-x(2))-x(1).*(1+...
(1-xfun(xdata)./456.86).*(x(3)+...
x(4).*456.86./xfun(xdata)))./(vfun(xdata).*(vfun(xdata)+x(2)));
function y=xfun(k);
x=[313.15 318.15 323.15 323.15 328.15 328.15 333.15 333.15 ...
333.15 338.15 338.15 338.15 343.15 343.15 343.15];
y=x(k);
function z=vfun(k);
v=[0.618,0.641,0.763,1.066,0.718,1.150,0.592,1.175,1.475,...
0.620,1.092,1.289,0.570,1.462,2.037];
z=v(k);
【 在 zhangsy (焚香气静) 的大作中提到: 】
: x=[313.15 318.15 323.15 323.15 328.15 328.15 333.15 333.15 333.15 338.15 338.1
: 5 338.15 343.15 343.15 343.15];
: v=[0.618,0.641,0.763,1.066,0.718,1.150,0.592,1.175,1.475,0.620,1.092,1.289,0.5
: ...................
--
╔═══════════════════╗
║★★★★★友谊第一 比赛第二★★★★★║
╚═══════════════════╝
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.229.*]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:7.110毫秒