Why do I get Cannot fit Power functions to data where X has nonpositive values when using the curve fitting tool?

12 次查看(过去 30 天)
Dear community,
Maybe my question is obvious, but I am trying to estimate a curve with negative values for x using the "power1" type curve fitting tool. However, Matlab shows me the following error: "Cannot fit Power functions to data where X has nonpositive values".
My question is, is there a way to get rid of this error, or by mathematical construction is it impossible?
I attach my x and y values.
Thank you in advance!
  10 个评论
Torsten
Torsten 2022-1-27
编辑:Torsten 2022-1-27
I'm not aware that a power function tends to 0 as x approaches -Inf and at the same time tends to +Inf as x approaches +Inf. So the last thing I would choose as fitting function is the power function.
I'm not sure what you mean by" function transformation". Could you clarify ?
Angelavtc
Angelavtc 2022-1-27
@TorstenThank you very much for all your help. I understand that you mean that an exponential function is a better fit for the data. With the transformation of the function, I meant just this. The answer is clear, the parameters will be different because we fit another function. I'm sorry for the obviousness of my question. Could your comment be an answer to accept it?

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2022-1-27
Torsten's idea for an exp1 fit works pretty well.
load myfile
f=fit(x,y,'exp1');
plot(f,x,y)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by