what does matlab do in A/b if both matrices are 1x4 matrices in order to come up with a number ???
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi There,
I hope any of your answer my question. I am a sophomore at SFSU and I am learning matlab on my own. my question is very simple I have 2 matrix of 1X4. A=[1 2 3 4] and b=[5 6 7 8]. I know if I type A*inv(b) will be an error because the matrix b is not invertible as I learned in linear algebra. But what does matlab exactly do when I type A/b in order to get me 0.4023?? I cant not figure it out. please, I would appreciate your help. How would I get to that number if I am trying to solve it manually????
Antworten (2)
Roger Stafford
am 18 Jun. 2016
Bearbeitet: Roger Stafford
am 18 Jun. 2016
When you write x = A/b, it is like writing x*b = A, and for this to make sense in your situation as far as size is concerned x must be of 1 x 1 size. Therefore this would a a set of four equations and only one unknown, an overdetermined system. The solution that matlab comes up with is a least squares approximation, since in general you cannot satisfy four equations exactly with only one unknown.
In your particular case with A = [1 2 3 4] and b = 5 6 7 8], the equations would be:
5*x = 1
6*x = 2
7*x = 3
8*x = 4
These obviously have no exact solution, so it finds the x for which
(5*x-1)^2 + (6*x-2)^2 + (7*x-3)^2 + (8*x-4)^2 =
174*x^2 - 140*x + 130
is a minimum. From calculus we know that the minimum occurs at the point where the derivative is zero:
x = 140/(2*174) = 0.402298851
though matlab uses a different method from this.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!