Error using betainc Z must be real and non-negative/polyfitn

조회 수: 4 (최근 30일)
stamos dontas
stamos dontas 2021년 1월 7일
편집: John D'Errico 2021년 1월 7일
Hello, i need to calculate the polynomial through regression that fits better to my output with 3 inputs. I downloaded polyfitn and i am just trying to understand how it works however i get this error. suppose i have:
aaa=[1; 2; 3; 4];
bbb=[5; 6; 7; 8];
ccc=[4; 5; 6; 7];
ddd=[ 15; 25; 67; 89];
ss=polyfitn([aaa,bbb,ccc],ddd,3)
Error using betainc
Z must be real and non-negative.
Error in polyfitn (line 266)
polymodel.p = betainc(polymodel.DoF./(t.^2 + polymodel.DoF),polymodel.DoF/2,1/2);
Error in Untitled2 (line 6)
ss=polyfitn([aaa,bbb],ddd,3)
Any help?
Thank in advance

답변 (1개)

John D'Errico
John D'Errico 2021년 1월 7일
편집: John D'Errico 2021년 1월 7일
You have 4 data points.
You are trying to estimate a model with how many unknown coefficients? (20. Yes. 20.)
I won't even get into the question of whether your data justifies the model you are trying to fit.
You need more data points than you have terms in the model, to have even a remote chance of solving for coefficients. That does not mean you will be able to do so, for a compliated model.
But let me check...
>> 20 > 4
ans =
logical
1
The call to betainc is probably used to determine if the parameters estimated are significantly different from zero. (Hey, it has been a zillion years since I wrote the code, and I don't have any reason to read it right now.)

카테고리

Help CenterFile Exchange에서 Special Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by