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

조회 수: 1 (최근 30일)
Alinjar Dan
Alinjar Dan 2022년 6월 11일
댓글: Walter Roberson 2023년 11월 9일
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

답변 (1개)

Avadhoot
Avadhoot 2023년 11월 9일
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
Walter Roberson
Walter Roberson 2023년 11월 9일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by