Array indices must be positive integers or logical values

조회 수: 1 (최근 30일)
Claudia Lizeth Medina López
Claudia Lizeth Medina López 2019년 11월 9일
편집: Jim Riggs 2019년 11월 9일
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