24小时热门版块排行榜    

查看: 1710  |  回复: 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的回帖

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的回帖

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的回帖

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的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

我现在有点不清楚你要做什么,区别两条曲线?他们方程a。b。c,d系数就不同啊,还有你给数据不就是和时间有关吗,如果还和其他因素有关,你也没有特别说明啊。
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.
11楼2011-10-31 11:01:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

你用这个方程式 a*x^0.7-12这个方程来拟合吧,基本r2都在0.9左右
算出一些的a后,用1.2...50来回归 可以用一次或者二次函数
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.
14楼2011-10-31 18:25:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
syy2468(金币+1): 版主,帮忙再加10上去,我不好操作 2011-11-01 15:06:51
cenwanglai(金币+15): 应楼主要求从楼主口袋转移15金币,呵呵 2011-11-02 09:49:06
我试了下,结果如下


附件中的文件 是matlab的拟合文件
打开方式
首先在matlab 命令窗口输入cftool
打开拟合工具箱 然后在工具箱窗口的file 菜单选load session
就可以打开查看了[ Last edited by dbb627 on 2011-10-31 at 18:41 ]
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.
15楼2011-10-31 18:30:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

估计版本不对,我的是matlab2010b
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.
17楼2011-11-01 11:14:33
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

引用回帖:
19楼: Originally posted by 小猪猪飞飞22 at 2015-11-01 17:39:09
请问用什么软件可以拟合这样的二元二次曲线...

matlab 软件就可以实现 sftool
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.
20楼2015-11-02 08:27:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 syy2468 的主题更新
信息提示
请填处理意见