数学建模社区-数学中国

标题: 多参数积分问题,麻烦大神看一下,thanks [打印本页]

作者: derekwang    时间: 2015-2-9 18:33
标题: 多参数积分问题,麻烦大神看一下,thanks
本帖最后由 derekwang 于 2015-2-9 18:47 编辑

clf,clear
I=@(k,t)(k(1)./((1+k(2)).^t)).^t; % R0=k(1),control parameter d = k(2)
load data3.txt; %data3.txt在附件中
tspan=data3(:,1);
Iexp=data3(:,2);
k0=[1.8,0.001];
ksim=nlinfit(tspan,Iexp,I,k0);
fprintf('\n\n使用函数nlinfit()估计得到的参数值为:\n')
fprintf('\t R0 = %.6e\n',ksim(1))
fprintf('\t d  = %.6e\n',ksim(2))
sse = sum((Iexp-I(ksim,tspan)).^2)./sum(Iexp)
a=size(tspan,1);
Isim=zeros(a,2);
for i =1:a
    Isim(i)=integral(@(t)I(t,ksim),0,tspan(i));
end
plot(tspan,Iexp,'ko',tspan,Isim(tspan),'r')
运行之后,出错了。。。。
Error using integralCalc/finalInputChecks (line 515)
Output of the function must be the same size as the input. If FUN is an array-valued
integrand, set the 'ArrayValued' option to true.







data3.txt

343 Bytes, 下载次数: 0, 下载积分: 体力 -2 点


作者: 阿远2014    时间: 2015-2-10 00:07
你参数输入输出的维数不一样





欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5