Chane
Chane

Reputation: 43

Matlab double summation of series

I am trying to use a function in Matlab which will give me the following equation:

enter image description here

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

Answers (2)

Buck Thorn
Buck Thorn

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

jmbr
jmbr

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

Related Questions