0
votes

It's a simple reordering the matrix Zb. (reorder by ordbar values as new index of Zb)

lZb = size(Zb,1);
Zbtemp = zeros(lZb,lZb);
for i = 1:lZb
    for i2 = 1:lZb
        b1=ordbar(i,1)
        b2=ordbar(i2,1)
        Zbtemp(b1,b2) = Zb(i,i2); 
    end
end

Problem is the matrix Zbtemp has all index numbers that are in ordbar. But in the two for, it say that index is invalid.

ordbar = [  2.  
            3.  
            4.  
            5.  
            1.]

and

Zb = [ 4+5*%i    4+5*%i    0         0         -4-5*%i    
       4+5*%i    6+9*%i    0         0         -6-9*%i    
       0            0      9+%i      9+%i       9+%i      
       0            0      9+%i      10+4*%i    10+4*%i   
      -4-5*%i    -6-9*%i   9+%i      10+4*%i    18+21*%i  ]

In other words, the values of the index exist (is valid) but scilab does not recognize the index.

1

1 Answers

0
votes

Solved with abs()

b1=abs(ordbar(i,1))
b2=abs(ordbar(i2,1))