deltalog matlab,matlab出现问题 - 计算模拟 - 小木虫 - 学术 科研 互动社区

1 function deconvolution

2 data=load('0.10-645.dat');

3 xdata=data(:,1);

4 ydata=data(:,2);

5 x0=[0.1];

6 %x(1)为脉宽,x(2)为时间零点,x(3)为A1,x(4)为t1,x(5)为A2,x(6)为t2

7 %-----------------------------------------------------------

8 options=optimset('TolFun',1e-4,'TolX',1e-4,'MaxIter',1e9,'MaxFunEvals',1e9);

9 [x,resnorm,residual,exitflag,output]=lsqcurvefit(@fun,x0,xdata,ydata,options);

10 disp('the fitted parameter isdelta   mu   A1   tau1   A2   tau2)');disp(x);

11 disp('the resnorm is:');disp(resnorm);

12 disp('the exit flag is:');disp(exitflag);

13 disp(output);

14 %--------------------------------------------------------------------------fit

15 Fp=fun(x,xdata);

16 irf=-1*2*sqrt(log(2))/0.06/sqrt(pi)*exp(-log(2)*(2*(xdata-x(2))/x(1)).^2)/20;

17 subplot(2,1,1); plot(data(:,1),Fp,'b-',xdata,ydata,'ro',xdata,irf,'g');

18 subplot(2,1,2); plot(data(:,1),residual,'g*');

19 %-------------------------------------------------------------------------

20 result=[xdata ydata Fp residual irf];

21 save -ASCII -DOUBLE result.dat result;

22 y=[x resnorm];

23 save -ASCII -DOUBLE parameters.dat y;

24 function F=fun(x,xdata)

25   delta1=x(1)/(sqrt(log(4)));

26    F1=x(3).*exp(delta1^2/x(4)^2/2).*exp(-(xdata-x(2))/x(4)).*(1+erf(((xdata-x(2))/delta1-delta1/x(4))/sqrt(2)));

27    F2=x(5).*(1+erf((xdata-x(7))/sqrt(2)/delta1)-exp(delta1^2/x(6)^2/2).*exp(-(xdata-x(7))/x(6)).*(1+erf(((xdata-x(7))/delta1-delta1/x(6))/sqrt(2))));

28    F=F1+F2;

执行命令时出现:

错误使用 lsqcurvefit (line 181)

LSQCURVEFIT requires the following inputs to be of data type double: 'LB'.

出错 Untitled2 (line 9)

[x,resnorm,residual,exitflag,output]=lsqcurvefit(@fun,x0,xdata,ydata,options);

应该如何修改?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值