Error taking inverse of a matrix

조회 수: 3 (최근 30일)
cdob
cdob 2015년 3월 20일
댓글: Roger Stafford 2015년 3월 20일
Hi,
I am receiving the error, "Subscript indices must either be real positive integers or logicals", when I attempt to take the inverse of a matrix. Can somebody please help me? Here is my code:
C = xlsread('OP_data.xlsx'); D = C;
y = log(C(:,3));
D(any(C==0,2),:)=[]; y(any(C==0,2),:)=[];
X = [ones(size(D,1),1),log(D(:,5)),log(D(:,6))];
Beta = inv(X'*X)*(X'*y);
Any help would be greatly appreciated!
  댓글 수: 1
Roger Stafford
Roger Stafford 2015년 3월 20일
Somewhere in your system there may be a variable with the name 'inv', which causes matlab to misinterpret your line "Beta = inv(X'*X)*(X'*y);". Try doing a
whos
to see if 'inv' shows up.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by