Problem with the use of “eig” in a Simulink Matlab function
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
we are implementing a Simulink model to retrieve the components of Quaternions from attitude determination block. While using the command "eig" in a matlab function, in order to retrieve the eigenvector corresponding to the maximum eigenvalue, with this procedure:
function q_eigen = fcn(K)
[q_e,lambda] = eig(K);
[lambda_max, col] = max(max(lambda));
q_eigen = q_e(:,col);
end
Simulink dispalys the error "Inferred complexity ("on") for data "q_eigen" does not match back propagated complexity ("off") from Simulink."
We have tried to put "real" command before q_e, but we obtain the same result.
2 件のコメント
Christine Tobler
2022 年 1 月 3 日
編集済み: Christine Tobler
2022 年 1 月 3 日
I don't know much about this, but the following older question seems related
and has some answers that to me seem promising to try out.
Using
q_eigen = real(q_eigen);
at the end of the function might remove this error, but unless you are very certain these eigenvectors are actually guaranteed to be real, it will mean returning a wrong result, since the imaginary component shouldn't just be discarded if it exists.
回答 (1 件)
Sulaymon Eshkabilov
2021 年 12 月 28 日
編集済み: Sulaymon Eshkabilov
2021 年 12 月 28 日
Maybe you can try max(max(real(lambda))) instead of real(q_e) to see your Simulink model simulation even though your eigenvalues are complex-valued.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Linear Algebra についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!