How I can fix the error in Custom equation
Show older comments
Hello everyone,
I want to fit this function F = a*X^b/(Y^c) to find the values of a,b,c. The input data are X, Y, F.
The error is "Complex value computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients."
I tried to adjust the values but it still doesn't work.
Please give me some advices. Thank you.
2 Comments
Torsten
on 31 May 2021
If your input data for X and Y are all positive, this error can not appear.
If some of the X or Y values are less or equal zero, remove them from the list of inputs for the optimizer.
Kim Uyen Nguyen
on 1 Jun 2021
Edited: Kim Uyen Nguyen
on 1 Jun 2021
Accepted Answer
More Answers (1)
Sulaymon Eshkabilov
on 31 May 2021
Edited: Walter Roberson
on 31 May 2021
1 vote
Hi,
you should check your data first and have a scope of what are your data ranges along x, y, ....
Here is a good discussion of this question:
2 Comments
Kim Uyen Nguyen
on 1 Jun 2021
Walter Roberson
on 1 Jun 2021
If your X or Y can go negative, then X^b can be complex valued if b is not an integer. X^b when b is not an integer, is defined as
exp(b * log(X))
but if X is negative then log(X) is complex, and if b is not an integer then multiplying it by b will give you something that exp() will leave as a complex number.
Categories
Find more on Descriptive Statistics and Insights 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!