24小时热门版块排行榜    

查看: 1698  |  回复: 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

荣誉版主 (著名写手)

引用回帖:
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的回帖
查看全部 20 个回答

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的回帖
信息提示
请填处理意见