how to find multiply variable in matrix multiplication

1 vue (au cours des 30 derniers jours)
Vishal Rajpurohit
Vishal Rajpurohit le 29 Mai 2018
function least_square;
x=[1 2 3 4 5];
y=[4;2;5;3;7];
n=numel(x);
for i=1:n
A(i,1)=1;
A(i,2)=x(i);
A(i,3)=x(i).^2;
end
we have matrix A(5x3) and matrix y(5x1) let a matrix a(3x1) satisfy Aa=y so any function or method to find matrix a?
  3 commentaires
Stephen23
Stephen23 le 29 Mai 2018
@Vishal Rajpurohit: Note that the output matrix A should be preallocated:
Vishal Rajpurohit
Vishal Rajpurohit le 29 Mai 2018
thankyou sir

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 29 Mai 2018

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by