Why Matlab shows "Index exceeds matrix dimensions"?
Afficher commentaires plus anciens
%Linearized system
SIGMA = 10;
R = 28;
BETA = 8/3;
x=0;
y=1;
z=0;
A=[-SIGMA, SIGMA, 0;
R-z, -1, -x;
y, x, -BETA];
j=3;
dim=3;
N=3;
[Q,~] = qr(rand(dim,j),0);
c = [zeros(1,j-1) 1];
for i=1:N,
QNew = A(: ,(i-1)*dim+1:i*dim)*Q;
[Q,~] = qr(QNew,0);
end
Q0=Q;
for i = (N+1):(2*N+1),
QNew = A(: ,(i-1)*dim +1: i*dim)*Q;
[Q,R] = qr(QNew ,0);
AllR = horzcat(R,AllR);
end
numOfR = size(AllR,2)/j;
for i = 1:numOfR
R = AllR(: ,(i-1)*j+1:i*j);
cNew = R\c;
c = cNew/norm(cNew);
end
w=Q0*c;
I get the error "Index exceeds matrix dimensions.
Error in ginelli (line 21) QNew = A(: ,(i-1)dim+1:idim)*Q;"
Thanks in advance!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!