Any alternates function to replace "eig"

Used "eig(A,B)" function to find eigen values and vectors.. When am converting it to C code and run at real time, it is taking too much time to give results.
Any suggestions to avoid "eig' function ? Or any suggestions to improve its speed ?
Thanks Sunil-Bangalore

4 Kommentare

KALYAN ACHARJYA
KALYAN ACHARJYA am 3 Okt. 2018
What type of Matrices data A, B?
Sunil Patil
Sunil Patil am 3 Okt. 2018
Bearbeitet: Matt J am 3 Okt. 2018
A = -inv(C)*G;
[X,D] = eig(A,eye(15),'qz');
h = inv(C)*Q.';
r = inv(X)*h;
G = Null matrix of order 15*15
C = contains nodal temperature (thermal model) of order 15*15
how i can improve this code to reduce time consumption. (solver time is more after converting it to C code).
Some time back,When i checked at mathworks site, Its said that, few of the functions ( eig,svd etc) get altered after converting into C for the optimization. What might be causing the solver to take more time ?
Thanks Sunil
Stephen23
Stephen23 am 3 Okt. 2018
Bearbeitet: Stephen23 am 3 Okt. 2018
@Sunil Patil: using inv like that is likely to be slow and inaccurate. The MATLAB documentation explicitly states "It is seldom necessary to form the explicit inverse of a matrix. A frequent misuse of inv arises when solving the system of linear equations Ax = b. One way to solve the equation is with x = inv(A)*b. A better way, from the standpoint of both execution time and numerical accuracy, is to use the matrix backslash operator x = A\b. This produces the solution using Gaussian elimination, without explicitly forming the inverse. See mldivide for further information."
Sunil Patil
Sunil Patil am 3 Okt. 2018
Thanks Stephen. I will check

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Christine Tobler
Christine Tobler am 3 Okt. 2018

0 Stimmen

The command
eig(A,eye(15),'qz');
solves the eigenvalue problem A*x = lambda*x, but makes EIG treat it as the generalized problem A*x = lambda*B*x, with B equal to the identity matrix. This should be expected to be slower. Is there a reason not to use
eig(A);
instead?
Alternatively, since A = -inv(C)*G, would it make sense to solve the generalized eigenvalue problem G*x = lambda*C*x instead?

Kategorien

Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 3 Okt. 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by