我在Matlab中的曲线拟合工具箱中使用由2个求和高斯组成的拟合拟合了一些数据 . Matlab能够非常好地为我绘制95%的上下置信区间 .

现在,我有一些新数据最适合由3个高斯组成的曲线,但在这种情况下工具箱不会绘制95%CI . 它沿曲线的所有点返回NaN,而不是95%CI的数值 .

以下是一些代码:

X = [0 1 2 3 4 5 6 7 8 9 10]';
Y = [0.009 0.014 0.031 0.044 0.062 0.065 0.052 0.037 0.037 0.027 0.026]';
STDV = [0.0028 0.0013 0.0047 0.00356 0.0077 0.0141 0.0072 0.0055 0.0055 0.0040 0.0055]';

[a1,b1,c1] = deal(0.036, 4.34, 2.02);
[a2,b2,c2] = deal(0.034, 6.78, 6.02);

fo1 = fitoptions('method','NonlinearLeastSquares','Lower',[-Inf -Inf 0]);
ok1 = isfinite(X) & isfinite(Y);
if ~all( ok1 )
    warning( 'GenerateMFile:IgnoringNansAndInfs',...
        'Ignoring NaNs and Infs in data.' );
end
st1 = [a1 b1 c1 a2 b2 c2];
set(fo1,'Startpoint',st1);
ft1 = fittype('gauss2');

% Fit this model using new data
cf1 = fit(X(ok1),Y(ok1),ft1,fo1);
% Plot this fit and the calculated dose points
h1 = plot(cf1,'fit',0.95);
set(h1(1),'Color',[0 0 0],...
    'LineStyle','-', 'LineWidth',1,...
    'Marker','none', 'MarkerSize',6);
hold on;
errorbar(X,Y,STDV,'*k')


%Break dose range into many intervals
Dose_range = 0:0.01:10;
%Plot confidence interval fits
load('ratio_lower.mat');
load('ratio_upper.mat');
plot(Dose_range,ratio_lower,'k:');
plot(Dose_range,ratio_upper,'k:');

'ratio_lower'和'ratio_upper'是从cftool中的分析GUI生成的CI . 它适用于2个求和的高斯,但不适用于3个求和的高斯 .