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. The “eig” command:
You can get different eigen values and eigen vectors due to numerous reasons as follows:
- 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.
- 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:
- https://www.mathworks.com/help/matlab/ref/balance.html
- 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.