Clear Filters
Clear Filters

How to select k elements from two vectors of length n > k that maximize the correlation between the two vectors?

2 views (last 30 days)
Hello everyone,
I have two numerical column vectors of length n, say vector A and vector B.
Consider a third column vector C which has k < n values equal to one, and zero otherwise.
I want C such that (A.*C)'*(B.*C) is maximized.
In other words, I need to decide which rows of A and B needs to remain (k of them needs to remain, n-k needs to me removed) to maximize the correlation between the vectors A and B. (In this sense, C can also be logical, 1 if row is in, zero if row is out)
Can you please help me to implement this maximization?
Many thanks for your help,
Marco
  3 Comments
Marco Brianti
Marco Brianti on 11 Nov 2021
Dear John,
thanks for your reply. It is about the correlation. My point is that (A.*C)'*(B.*C) is somehow proportional to corr(A.*C,B.*C). Note that bewteen (A.*C)' and (B.*C) there is no dot-produc but only product. I am transposing the first vector such that the outcome is a scalar.
Does it make sense?
Many thanks,
Marco

Sign in to comment.

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!