Array indices must be positive integers or logical values

1 次查看(过去 30 天)
I'm trying to do the Bairstow method but the fuctions to get delta r and delta s mark me as an error
coeff= length(fx);
r=r0;
s=s0;
ErrR=100;
ErrS=100;
while ErrR>tol || ErrS>tol
fx=fx(coeff:-1:1);
b(coeff)= fx(coeff)
b(coeff-1)= fx(coeff-1)+r*b(coeff);
for rs=(coeff-2:-1:1)
b(rs)= fx(rs)+r*b(rs+1)+s*b(rs+2);
end
c(coeff)= b(coeff);
c(coeff-1)= b(coeff-1)+r*c(coeff);
for rs=(coeff-2:-1:2)
c(rs)= b(rs)+r*c(rs+1)+s*c(rs+2);
end
deltaR= (b(0)*c(3)-b(1)*c(2))/((c(2))^2-c(1)*c(3))
deltaS= (b(1)*c(1)-b(0)*c(2))/((c(2))^2-c(1)*c(3))
r= deltaR+r;
s= deltaS+s;

回答(1 个)

Jim Riggs
Jim Riggs 2019-11-9
编辑:Jim Riggs 2019-11-9
Matlab does not allow an index value of zero.
deltaR = (b(0) ...
similar in deltaS.

类别

Help CenterFile Exchange 中查找有关 Direct Search 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by