Filter löschen
Filter löschen

Projection matrix equation equivalent?

3 Ansichten (letzte 30 Tage)
tree317
tree317 am 21 Okt. 2017
Kommentiert: tree317 am 21 Okt. 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)

Akzeptierte Antwort

Image Analyst
Image Analyst am 21 Okt. 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 Kommentar
tree317
tree317 am 21 Okt. 2017
Image Analyst,
Very very helpful - a sincere thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by