Reputation: 43
I am trying to use a function in Matlab which will give me the following equation:
The x
and a
values are in two matrices. I have tried almost everything, but cannot get the correct answer. Anyone who can help??
Thanks
Upvotes: 0
Views: 523
Reputation: 5073
Another way to do this is
a = sqrt(ain); % ain is your input column vector
A = a*a.';
A = A-diag(diag(A));
aresult = x.'*A*x % x is your (other) input column vector
Upvotes: 1
Reputation: 3348
Assuming A and X are vectors of size n x 1, you could construct that expression by writing transpose(X) * (sqrt(A * transpose(A)) .* (ones(n) - eye(n))) * X
.
Upvotes: 1