Code Analyzer: INV is slow and inaccurate

前端 未结 3 1333
一向
一向 2021-01-23 09:16

When I try to calculate a matrix inverse using Matlab\'s inv() operation:

A = rand(10,10);
b = rand(10,1);

C = inv(A);
D = C*b;

I get the foll

3条回答
  •  借酒劲吻你
    2021-01-23 10:02

    Some additional information:

    If you are to calculate

    Ax = b
    

    For many different b's, but with a constant A, you might want to pre-factorize A. That is:

    [L U P] = lu(A);
    x = (U \ (L \ ( P * b)));
    

    Don't know about other fields, but this occurs frequently in power system engineering at least.

提交回复
热议问题