Use of Command like 'eig', 'null' in MATLAB-SIMULINK

2 vues (au cours des 30 derniers jours)
Alinjar Dan
Alinjar Dan le 11 Juin 2022
NEED URGENT HELP!!
This is a .m file coded inside a MATLAB-SIMULINK file. The picture of taht code is attached.
I am getting two strange errors with 'eig' and 'null' commands as mentioned below.
  • While using 'eig' command for the matrix A in the code, I am getting eigen vectors in V which are different from the ones that we get if we store the matrix A for every time step and perform the eigen analysis seperately after the MATLAB-SIMULINK code finishes running.
  • Regarding 'null' command, I am getting an error as attached below.
Can anybody enligh

Réponses (1)

Avadhoot
Avadhoot le 9 Nov 2023
Hi Alinjar,
I understand that you are facing issues with the use of the “eig” and “null” commands. Let us address both the issues one by one.
1. Theeig” command:
You can get different eigen values and eigen vectors due to numerous reasons as follows:
  1. The matrix A itself is changing during the execution of the loop. Check if the matrix is varying inside the loop due to some reason.
  2. Numerical inconsistencies in the calculations can cause variation in the results. “eig” uses approximate numerical nethods for calculating eigen values and eigen vectors. To achieve more precision in the results consider using the “eigs” command as it uses more advanced algorithms for computing eigen values and eigen vectors. On the other hand you can also consider using the “balanceOption” input argument in “eig” command to perform diagonal scaling on the matrix to get more accurate results.  
For more information about the “eigs” command refer the below documentation:
To know more about the “balanceOption” argument in “eig” refer the following documentation:
  1. https://www.mathworks.com/help/matlab/ref/balance.html
  2. https://www.mathworks.com/help/matlab/ref/eig.html?a#btgapg5-1-balanceOption
2. The “null” command:
The second issue is with the “null” command throwing an error. It is caused by an inconsistency in the size specification of matrix “VR”. The matrix “VR” is specified as a variable size matrix of inherited size. So to resolve the error please make the matrix “A” as variable size in Simulink so the inconsistency gets resolved as “VR” is derived from “A”.
More information about variable sized data can be found on the following page:
I hope this helps.
  1 commentaire
Walter Roberson
Walter Roberson le 9 Nov 2023
Note that eigs can be much slower. But it depends exactly what you ask for: eigs() allows selecting which eigenvalues to look for, and in some cases can be fairly efficient, such as calculating a small number of values for a large array.

Connectez-vous pour commenter.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by