logo elektroda
logo elektroda
X
logo elektroda

[Matlab] Calculating Inverse Matrix: Comparing Two Methods and Resolving Errors in Code Example

plotek5 13497 2
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16397266
    plotek5
    Level 11  
    I want to count the reverse matrix in matlab in the following way:

    A=[2 1 1; 0 2 2; 0 0 4];
    iA=inv(A);
    A*iA
    iA*A
    


    and something wrong returns, while the following way is ok:
    
    A=[2 1 1; 0 2 2; 8 8 4];
    Id=eye(size(A));
    iA=A\Id
    iA2=inv(A)
    norm(iA*A,1)
    norm(iA-iA2,1)


    Any hint of what needs to be changed in the first code? :)
  • ADVERTISEMENT
  • #2 16399294
    ShinsPL
    Level 14  
    After all, the inv () function enumerates the inverse matrix.
    How do you enter the code:
    Code: text
    Log in, to see the code

    this will give you a diagonal matrix with both multiplication - which means that the matrices are the opposite.
  • #3 16427984
    plotek5
    Level 11  
    Resolved: I did not notice an unfortunate semicolon at the end inv ...
ADVERTISEMENT