- 积分
- 0
- 注册时间
- 2011-9-30
- 仿真币
-
- 最后登录
- 1970-1-1
|
我现在需要对一组数据进行模型的参数识别,模型如下:
其中,时程变量有:σ ε,相关数据参见附件,时间步为0.01s
参数变量有
因为这个模型中涉及了两5个中间变量,其中有3个可以用线性消掉,但还有z 和 e,是微分方程
我之前尝试着用最小二乘法来拟合,但总有报错,代码如下:
- % % 使用如下参数得到的试验数据alpha=0.02;k0(E)=500;A0=1;n=1;beta=2;gamma=2;deltaA=0;detlaNu=0.01;detlaEta=0.01;
- function friction
- clear all
- clc
- load x.mat;load dx.mat;
- Z=load('F.mat');
- Z=Z.F;
- tspan=0:0.01:20;
- lb = -[1 1 1 1 1 1 1 1 1]*1e8;
- ub = [1 1 1 1 1 1 1 1 1]*1e8;
- k0=[0 550 1.2 0.5 1 1 0 0.001 0.001];
- [k,resnorm,residual,exitflag,output,lambda,jacobian]=lsqnonlin(@objfun,k0,lb,ub,[],tspan,Z);
- fprintf('\n\n使用函数lsqnonlin()估计得到的参数值为:\n')
- fprintf('\tk1 = %.9f \n',k(1))
- fprintf('\tk2 = %.9f \n',k(2))
- fprintf('\tk3 = %.9f \n',k(3))
- fprintf('\tk4 = %.9f \n',k(4))
- fprintf('\tk5 = %.9f \n',k(5))
- fprintf('\tk6 = %.9f \n',k(6))
- fprintf('\tk6 = %.9f \n',k(7))
- fprintf('\tk6 = %.9f \n',k(8))
- fprintf('\tk6 = %.9f \n',k(9))
- figure(1)
- [Ts Ys]=ode15i(@kinetics,tspan,0,0,[],k);
- FF=k(1)*k(2)*x(Ts)+(1-k(1))*k(2)*Ys;
- plot(Ts,FF,'r')
- hold on
- plot(Ts,Z)
- function dy=kinetics(t,y,fy,k)
- dy=fy-[(k(6)-k(7)*y(2)-pow(fabs(y(1)),k(4))*(k(5)+k(3)*signum(dx*y(1)))*(1.0+ k(8)*y(2)))*dx/(1+k(9)*y(2));
- (1-k(1))*k(2)*dx*y(1)];
-
-
- function ff=objfun(k,tspan,Z)
- [T Y]=ode15i(@kinetics,tspan,0,0,[],k);
- FF=k(1)*k(2)*dx+(1-k(1))*k(2)*Y;
- ff=Z-FF;
复制代码
大家帮我看看,这个代码的问题在哪里?或者有没有别的解决办法,可供参考?
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|