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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by