Using erfcinv and array indices are being rejected as not positive or valid, despite all being positive in the vector
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, I am currently working on some research data analysis and have been trying to fit autocorrelated data to a plot with a 95% confidence interval to check the distribution of the residuals. To do this, I'm working from the mathworks autocorrelation page (https://www.mathworks.com/help/signal/ug/residual-analysis-with-autocorrelation.html). When trying to set the confidence interval, I get the error that all array indices must be positive or logical values. Below is the code that I'm using, as well as residual data set.
erfbatp = erfcinv(a.Residuals.Raw);
erfbatp = erfbatp';
erfbatp = erfbatp(~isnan(erfbatp))';
conf99batp = sqrt(2)*erfbatp(2*.05/2);
lconfbatp = -conf99batp/sqrt(length(a.Residuals.Raw));
upconfbatp = conf99batp/sqrt(length(a.Residuals.Raw));
1.52973772211594
1.58151023710729
1.53641175549635
1.68852456597857
1.36494692501592
2.07737261195390
1.50753906916397
2.02256675790035
1.05155195289689
1.40278856349961
2.16079514557325
1.43199717380622
1.48556496430640
1.42827621898581
1.62133741215299
1.34671652045243
1.62813386205574
1.41104099011439
1.50196551118339
1.34604336518968
1.47733944833881
1.19896422993831
1.72322100428785
Above is the residual values in the erfbatp variable after removing NaNs, any advice or information would be appreciated.
0 Kommentare
Antworten (1)
Torsten
am 3 Okt. 2024
Bearbeitet: Torsten
am 3 Okt. 2024
As far as I understand, "erfbatp" is an array of numbers.
So erfbatp(2*.05/2) = erfbatp(0.05) does not make sense, does it ? Valid array indices are 1,2,3,4,...
3 Kommentare
Torsten
am 3 Okt. 2024
I don't see it is used on the MATLAB site this way. I could only find
conf99 = sqrt(2)*erfcinv(2*.01/2);
lconf = -conf99/sqrt(length(x));
upconf = conf99/sqrt(length(x));
which looks correct.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!