24小时热门版块排行榜    

查看: 1690  |  回复: 19

syy2468

金虫 (正式写手)

忠实虫友

[求助] 高手帮忙拟合一组曲线,解决另加分!


这组曲线符合什么函数呢,过一定点(t0,-A),之前我用这个函数:y=-a*(ln(t)-ln(tmax))/(ln(tmin)-ln(tmax)); 拟合出来曲线弧度不够,有点直。t是每条曲线下降的时间段,这里tmin就是起点t0,tmax就是每条曲线到达0的时间点。

请高手帮忙解决,会提示思路,感激不尽啊!另加分!
回复此楼
飞跃2017
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

你最好把数据给出来,符合这种形状的方程式有很多,不拿数据试一下怎么知道哪个合适
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2011-10-28 11:39:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

syy2468

金虫 (正式写手)

忠实虫友

引用回帖:
2楼: Originally posted by dbb627 at 2011-10-28 11:39:02:
你最好把数据给出来,符合这种形状的方程式有很多,不拿数据试一下怎么知道哪个合适

数据已上传
飞跃2017
3楼2011-10-28 14:05:08
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★
cenwanglai(金币+3): 幸苦了。这个忙帮起来很快吗? 2011-10-31 11:08:33
使用f(x) = a*exp(b*x) + c*exp(d*x)这个模型基本可以达到要求
初始值的不同,可能会有差异
CODE:
function [cf,good]=datafit(data)
A=data(47:135,:);
yy=A(:,2:51);
y=[];
n=5;
cf=cell(1,n);
good=cell(1,n);
for i=1:n
     y=yy(:,i);
     y=y(y~=0);
     t=[1:length(y)]';
        
k0 =[-10+20*rand -1+2*rand -10+20*rand(1) -1+2*rand];
f=@(p,x)(p(1)*exp(p(2)*x(:,1)) + p(3)*exp(p(4)*x(:,1))-x(:,2)).^2;
[st,re]=lsqnonlin(f,k0,[],[],[],[t y])
  [cf{1,i},good{1,i}]=expfit(t,y,st)
end
     

function [cf_,good]=expfit(t,y,st)
%exp2: f(x) = a*exp(b*x) + c*exp(d*x)
ft_ = fittype('exp2');
[cf_,good]= fit(t,y,ft_ ,'Startpoint',st);
h_ = plot(cf_,'fit',0.95);
legend off;  % turn off legend from plot method call
set(h_(1),'Color',[1 0 0],...
     'LineStyle','-', 'LineWidth',2,...
     'Marker','none', 'MarkerSize',6);
hold on,plot(t,y,'*')
ylim([-12,0])
xlim([0 90])



The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2011-10-28 16:12:13
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

syy2468(金币+4): 这个题目解起来很繁,先奖励一下 2011-10-31 11:13:39
fit 1
General model Exp2:
     f(x) = a*exp(b*x) + c*exp(d*x)
Coefficients (with 95% confidence bounds):
       a =  1.474e-014  (-8.61e-014, 1.156e-013)
       b =      0.3711  (0.2937, 0.4486)
       c =      -12.03  (-12.15, -11.91)
       d =     -0.0116  (-0.01188, -0.01132)

Goodness of fit:
  SSE: 3.872
  R-square: 0.9925
  Adjusted R-square: 0.9923
  RMSE: 0.2134
fit 2
General model Exp2:
     f(x) = a*exp(b*x) + c*exp(d*x)
Coefficients (with 95% confidence bounds):
       a =       1.429  (0.8846, 1.974)
       b =    0.003835  (0.0009759, 0.006695)
       c =       -13.6  (-14.13, -13.07)
       d =    -0.01922  (-0.02002, -0.01843)

Goodness of fit:
  SSE: 0.05904
  R-square: 0.9999
  Adjusted R-square: 0.9999
  RMSE: 0.02636
....
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
5楼2011-10-28 16:14:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

syy2468

金虫 (正式写手)

忠实虫友

引用回帖:
5楼: Originally posted by dbb627 at 2011-10-28 16:14:30:
fit 1
General model Exp2:
     f(x) = a*exp(b*x) + c*exp(d*x)
Coefficients (with 95% confidence bounds):
       a =  1.474e-014  (-8.61e-014, 1.156e-013)
       b =      0.3711  (0.2937, 0.448 ...

x指的什么
飞跃2017
6楼2011-10-31 10:36:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

x应该就是自变量 或者说是时间t
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
7楼2011-10-31 10:38:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

syy2468

金虫 (正式写手)

忠实虫友

引用回帖:
7楼: Originally posted by dbb627 at 2011-10-31 10:38:45:
x应该就是自变量 或者说是时间t

每条曲线的曲率怎么区别的
飞跃2017
8楼2011-10-31 10:48:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

曲率,这个要另外算的吧

曲率半径就是曲率的倒数。曲率计算公式如下
函数形式:曲率k=y''/[(1+(y')^2)^(3/2)],其中y', y"分别为函数y对x的一阶和二阶导数;
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
9楼2011-10-31 10:54:20
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

syy2468

金虫 (正式写手)

忠实虫友

引用回帖:
9楼: Originally posted by dbb627 at 2011-10-31 10:54:20:
曲率,这个要另外算的吧

曲率半径就是曲率的倒数。曲率计算公式如下
函数形式:曲率k=y''/[(1+(y')^2)^(3/2)],其中y', y"分别为函数y对x的一阶和二阶导数;

我指的是如何区别两条曲线,你给出的拟合方程只是时间的函数,那如何区别两条曲线呢
飞跃2017
10楼2011-10-31 10:56:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 syy2468 的主题更新
信息提示
请填处理意见