Help with linear optimisation problem

1 回表示 (過去 30 日間)
Teshan Rezel
Teshan Rezel 2022 年 1 月 25 日
コメント済み: Teshan Rezel 2022 年 1 月 31 日
Hi folks,
I'm looking to conduct a linear optimisation and was hoping for some help on the matter.
I have 56 columns of data, with 256 rows each; lets call this set A. I have another column of data, with 56 rows; lets call this set B. I essentially want to correlate each of the 256 values in each column of set A to a single value in set B; lets call this set C.
I want to know which of the 256 values across set C give the best correlation between sets A and B. In other words, which row in set A gives the best correlation to the corresponding value in set B, across all columns of set A.
Any help on this matter would be most appreciated!

採用された回答

Matt J
Matt J 2022 年 1 月 25 日
編集済み: Matt J 2022 年 1 月 25 日
Diffs=abs(reshape(B,1,1,[])-A);
d=min(Diffs,[],3);
[Arows,Acols]=find(d==min(d(:)));
  11 件のコメント
Matt J
Matt J 2022 年 1 月 31 日
編集済み: Matt J 2022 年 1 月 31 日
A=load('inputVariables').sum_Coke;
B=load('inputVariables').CRI;
B=B.CRI;
whos A B
Name Size Bytes Class Attributes A 256x54 110592 double B 54x1 432 double
Diffs=abs(reshape(B,1,1,[])-A);
d=min(Diffs,[],3);
[Arows,Acols]=find(d==min(d(:)));
whos Arows Acols
Name Size Bytes Class Attributes Acols 84x1 672 double Arows 84x1 672 double
Teshan Rezel
Teshan Rezel 2022 年 1 月 31 日
@Matt J outstanding, thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by