I get an error when calling the eig() function.
First I thought my matrix is somehow 'bad' for computing the eigenvalues.
But even if I just type
eig(eye(4))
I get the following error:
"Subscript indices must either be real positive integers or logicals."

 채택된 답변

Titus Edelhofer
Titus Edelhofer 2015년 10월 7일

0 개 추천

Hi,
this means, that using eye(4) is not valid for indexing (which is true, since it contains zeros). This implies, that you have a variable named eig, that shadows the function.
whos eig
probably tells you that eig is a variable. Remove it
clear eig
and then eig(eyes(4)) should do what you expected.
Titus

댓글 수: 1

Rebekka Klara Gasser
Rebekka Klara Gasser 2015년 10월 7일
Ah I see!
You're right. I named a variable 'eig' which was not really clever.
Thank you!

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by