Using fit function ignoring NaN

87 views (last 30 days)
Paola
Paola on 17 Mar 2022
Commented: Paola on 20 Mar 2022
Hi,
how can I use the fit function ignoring the NaN values in my y vector?
Thanks
  1 Comment
Torsten
Torsten on 17 Mar 2022
By removing them before calling the fit function.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 17 Mar 2022
include=~isnan(y);
fobj = fit(x(include),y(include),fitType)

More Answers (0)

Categories

Find more on Curve Fitting Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!