- row vectors of size 1xN then I would expect to get a 1x1 output.
- column vectors of size Nx1 then I would expect to get an NxN output.
two column vector division
33 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
%two column vector division
a = [1 2 3 0 0 0 4 5 6];
b = [2 4 6 0 0 0 8 10 12];
a/b
%two column vector division without zero
aa = [1 2 3 4 5 6];
bb = [2 4 6 8 10 12];
aa/bb
What is a mathematical formula? It doesn't work with two row vectors with the division. Why?
Thank you!
DK.
0 comentarios
Respuestas (1)
Stephen23
el 24 de Abr. de 2019
Editada: Stephen23
el 24 de Abr. de 2019
"two column vector division"
All of your examples use row vectors, not column vectors.
"What is a mathematical formula?"
"It doesn't work with two row vectors with the division"
Yes, it does work: it solves that system of linear equations, exactly like its help states. Following standard rules for solving systems of linear equations, if both arguments are
And that is exactly what we do get:
>> [1,2,3] / [4,5,6]
ans = 0.41558
>> [1;2;3] / [4;5;6]
ans =
0.051948 0.064935 0.077922
0.103896 0.129870 0.155844
0.155844 0.194805 0.233766
"Why a/b and mean(a)/mean(b) are different?"
The documentation clearly states that for a scalar first argument mrdivide is equivalent to rdivide (i.e. divides the first argument by the second), so your example with mean simply divides values. All of your other examples solve systems of linear equations.
If you are doing two different operations, then two different outputs is to be expected.
4 comentarios
Ver también
Categorías
Más información sobre Linear Algebra en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!