Borrar filtros
Borrar filtros

Projection matrix equation equivalent?

3 visualizaciones (últimos 30 días)
tree317
tree317 el 21 de Oct. de 2017
Comentada: tree317 el 21 de Oct. de 2017
Hello,
I am relative new to matlab and would sincerely appreciate some help in understanding the logic of calculations that use the following notation.
A = B(i,:) * B';
I am familiar enough with matlab to understand most of its syntax so my question isn't about understanding what this expression is saying but rather the operation behind it.
For example if B = rand(10,3) what sequence of operations would produce the equivalent result for A to the above?
(I would like to unpack this so that I can build an equivalent function in C)

Respuesta aceptada

Image Analyst
Image Analyst el 21 de Oct. de 2017
To reproduce in C you'd need for loops. I believe this explains it:
B = rand(10,3);
i = 4; % Whatever....
% Method 1:
A = B(i,:) * B'
[rows, columns] = size(B)
% Method 2:
A2 = zeros(1, rows);
for row = 1 : rows
for col = 1 : columns
A2(row) = A2(row) + B(i, col) * B(row, col);
end
end
A2
% Check to make sure they're the same
% Will show 1 if they're equal.
isequal(A, A2)
  1 comentario
tree317
tree317 el 21 de Oct. de 2017
Image Analyst,
Very very helpful - a sincere thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre R Language 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!

Translated by