>>
X = load('Xg.dat');
>> y = load('perm.th30.abs.y.ocn.dat');
>> y = load('perm.th30.abs.y.ocn.dat');
>> beta = inv(X'*X)*X'*y;
>> yhat = X(:,[1 2 3]*beta([1 2 3])
yhat = X(:,[1 2 3]*beta([1 2 3])
↑
Error: Invalid expression. When calling a function
or indexing a variable, use parentheses. Otherwise,
check for mismatched delimiters.
Did you mean:
>> yhat = X(:,[1 2 3]*beta([1 2 3]))
Error using *
Incorrect dimensions for matrix multiplication.
Check that the number of columns in the first matrix
matches the number of rows in the second matrix. To
perform elementwise multiplication, use '.*'.
>> yhat = X(:,[1 2 3].*beta([1 2 3]))
Index in position 2 is invalid. Array indices must
be positive integers or logical values.