help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some multi dimensional matrix problem


From: jin law
Subject: Re: Some multi dimensional matrix problem
Date: Sun, 16 Sep 2018 13:22:08 +0800

Hi! I have 2 matrix X and y with mxn dimension. I doing rowwise operations using for loop.

the answer I got is 2X1 array, I want to find the closer match between the 2 operations,which is

Theta >=theta. Because of the results of the both operations is not a single vector so I can't get the

answer. I tried to reshape, an error occur. I tried using bsxfun, I am out of my wit. Please help me.

Thanks.

 

regards,

Jin

>> for j=1:8;

y=Data(:,j);

X=[ones(m,1),data(:,j)];

theta=round(pinv(X'*X)*X'*y);

disp(theta);

end

   82

    1

   1739

      1

   2078

      1

   1845

      1

   953

     1

   1121

      1

  -210

     1

   2546

      1

>> y=Data(:,j);

>> for j=1:8;

y=Data(:,9);

X=[ones(m,1),data(:,j)];

Theta=round(pinv(X'*X)*X'*y);

disp(theta);

end

   19

    1

   1767

      1

   1926

      1

   1980

      1

   961

     1

   935

     1

  -334

     1

   2549

      1

 

>> for j=1:8;

y=Data(:,j);

X=[ones(m,1),data(:,j)];

theta=round(pinv(X'*X)*X'*y);

reshape(theta,16,1);

disp(theta);

end

error: reshape: can't reshape 2x1 array to 16x1 array

syntax error

 

>>> bsxfun(@time,pinv(X'*X)*X'*y),X,y)

                                   ^

  

 

Sent from Mail for Windows 10

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]