フィルターのクリア

How can I write a script for a default fit option for a gaussian fit?

5 ビュー (過去 30 日間)
Trishal Zaveri
Trishal Zaveri 2018 年 2 月 15 日
回答済み: Image Analyst 2018 年 2 月 16 日
I am trying to make a custom fit for my data using the Gaussian fit, but how do I go about setting that up. Currently I have this script:
ft = fittype( 'gauss1' );
opts = fitoptions( 'Method', 'LinearLeastSquares' );
opts.Lower = [-Inf -Inf -Inf];
opts.Upper = [Inf Inf Inf];
[fitresult, gof] = fit(xData, yData, ft, opts );
When I enter "opts.MaxInter = (600);" it gives me an error and does not include it in my fit options. How can I set up the MaxInter, and the other values that are in the fit options in my script. I appreciate any help!!
  2 件のコメント
Image Analyst
Image Analyst 2018 年 2 月 15 日
Also give code to generate xData and yData so we can run your code.
Trishal Zaveri
Trishal Zaveri 2018 年 2 月 16 日
My data points are currently arbitrary. My xData is [2, 1.35, 0, 1, 2, 3.4, 4, 4.5, 6.3, 8]. My yData is [0.05, .3, .7, 1.9, 2, 2.5, 3.7, 2.2, 1.5, .5]. I know it can be a simple fit, but I just want to get used to it when I have more numbers for the data.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2018 年 2 月 16 日
See attached demo to fit a Gaussian shape to some noisy data that roughly traces out a Gaussian shape.

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by