Why does NLINFIT result in complex beta parameters in Statistics Toolbox 7.3 (R2010a)?

13 ビュー (過去 30 日間)
I would like to know if there is a way to prevent some of the beta parameters that are returned from NLINFIT from becoming complex numbers.
I would also like to know, what should a user do in case he receives beta parameters that are complex numbers that do not fit the physical problem he is trying to solve.

採用された回答

MathWorks Support Team
MathWorks Support Team 2010 年 4 月 30 日
NLINFIT does not produce complex parameter estimates if the x/y inputs and the function values return real inputs.
The most likely cause of the issue is that the model function is returning complex results for some inputs. If the function has been written by the user, he can put a check in the function if the result is real before returning. Another possibility is to edit the nlinfit.m file and add a check for real inputs to the checkFunVals subfunction. To edit the NLINFIT function:
1. Execute the following in the MATLAB command prompt:
edit nlinfit
2. Navigate to the chckFunVals function and add the following code to it:
% check if the function has real output
if any(~isreal(v))
error('stats:nlinfit:NonRealFunOutput', ...
'MODELFUN has returned complex values.');
end
One likely cause of the complex outputs of the function is that a positivity constraint must be enforced on one of the parameters. NLINFIT does not directly support such constraints. NLINFIT may try a negative value for the parameter, but if your model function takes a square root or another function that for a negative input returns a complex value, complex result is ensured. If that is the problem, a solution might be to reparameterize the problem using the log of that parameter, which will be unconstrained. Quite often, this is a better parameterization for positive parameters, as it makes the estimator closer to normal.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCluster Analysis and Anomaly Detection についてさらに検索

タグ

タグが未入力です。

製品


リリース

R2010a

Community Treasure Hunt

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

Start Hunting!

Translated by