How to use curve fitting to get a baseline

12 ビュー (過去 30 日間)
Anahita Z
Anahita Z 2016 年 10 月 9 日
コメント済み: Jacob Spencer 2020 年 10 月 2 日
I am using the curve fitting toolbox to generate a baseline. I can save my fit to my workspace but am not sure how to subtract that fit now. I get the error "Undefined operator '-' for input arguments of type 'cfit'." Any help would be appreciated.
  2 件のコメント
KSSV
KSSV 2016 年 10 月 10 日
Attach the code so far you have done..
Jacob Spencer
Jacob Spencer 2020 年 10 月 2 日
I'm sure this may be a little late... but nevertheless, cfit is a constructor-type object (see https://www.mathworks.com/help/curvefit/cfit.html) used to generate the fitting function; i.e. what you are trying to fit to the baseline. This does not contain the values for your fit as an array. If you want to subtract the fit from your data, you will need to evaluate your cfit object in terms of your x range, e.g.:
y_fit = feval(fittedmodel,x); %fittedmodel is the default variable name saved from the curve fitting toolbox for the cfit object
plot(x,y,x,y_fit)

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeFit Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by