Error taking inverse of a matrix

2 views (last 30 days)
cdob
cdob on 20 Mar 2015
Commented: Roger Stafford on 20 Mar 2015
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 Comment
Roger Stafford
Roger Stafford on 20 Mar 2015
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.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!