近似でエラーが発生し​ました。どなたか解消​方法を教えていただき​たいです。

4 views (last 30 days)
shunya hara
shunya hara on 4 Nov 2020
下のようなプルグラムを実行したところ、「エラー: fit>iFit (line 348)
Inf がモデル関数で計算されました。近似を続けることはできません。
係数の上限と下限を使用するか、範囲を狭めてみてください。
エラー: fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...」
というエラー文が出てきました。関数に範囲は設定してあるのですがどのようにしたらこのエラーを解消できますか?
for n = 1:2048;
for m = 1:2048;
[xData, yData] = prepareCurveData( [], C(n,m,1:195) );
% 近似タイプとオプションを設定します。
ft = fittype( 'gauss1' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [-Inf -Inf 0];
opts.StartPoint = [3091 178 160.226378472824];
% モデルをデータに近似します。
c = fit( xData, yData, ft, opts );
b=coeffvalues(c);
l=b(1,1);
k=b(1,2);
if 10000<l<30000;
B(n,m,1)=k;
else
B(n,m,1)=0;
end
end
end

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!