??? Error using ==> lsqcurvefit at 253 Function value and YDATA sizes are incommensurate.
1 次查看(过去 30 天)
显示 更早的评论
Hello, I am trying to find parameters that best fit a model function. I am using the following script : Y=[Y1; Y2; Y3; Y4; Y5; Y6];
N=[N1; N2; N3; N4; N5; N6]; xdata=N'; ydata=Y';
ydata = ydata(~isnan(ydata)); ydata = ydata(~isinf(ydata));
xdata = xdata(~isnan(xdata)); xdata = xdata(~isinf(xdata));
fun=@(p,xdata)p(1)*exp(-(xdata./p(2)).^p(3)); x0=[1 1 1]; lsqcurvefit(fun,x0,xdata,ydata)
when I run my program I get the error message : " _??? Error using ==> lsqcurvefit at 253 Function value and YDATA sizes are incommensurate._" . I ve checked the sizes of xdata, ydata and fun(x0,xdata), and they are all the same size.
Thanks for your help!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!