フィルターのクリア

minimum of a function

2 ビュー (過去 30 日間)
Arif Ullah khan
Arif Ullah khan 2016 年 3 月 6 日
コメント済み: Image Analyst 2016 年 3 月 6 日
Hello sir;
i am trying to find minimum of a function by putting more than one vectors in a single step to get a constant cost value.
bk=magic(4)=[16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1]
function=bk1'*H1'*H1*bk1-2*yr'*H1*bk1;
where yr is a column vector, H1 is a square matrix and bk1 is a column of bk.
i want to put each vector of bk in above function and select the minimum value in a single command.
i tried this one but it doesn't works.
[cost_value, indx]=min(abs(bk(:,[1:end])'*H1'*H1*bk(:,[1:end])-2*yr'*H1*bk(:,[1:end])));
please help
  3 件のコメント
Arif Ullah khan
Arif Ullah khan 2016 年 3 月 6 日
thnx for reply how but can i implement this to get the minimum value as well the index of the vector which gives the minimun value
Arif Ullah khan
Arif Ullah khan 2016 年 3 月 6 日
actually i want to find the column of bk which gives minimum value for the expression

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

採用された回答

Image Analyst
Image Analyst 2016 年 3 月 6 日
What is bk1 and H?
Anyway, why not just assign it to a numerical array and use min:
f =bk1'*H1'*H1*bk1-2*yr'*H1*bk1
[minFValue, linearIndexAtMinFValue] = min(f(:));
or
[rowAtMin, colAtMin] = find(f == min(f(:)))
  2 件のコメント
Arif Ullah khan
Arif Ullah khan 2016 年 3 月 6 日
編集済み: Arif Ullah khan 2016 年 3 月 6 日
bk1 is each column of bk matrix while H1 is a square matrix actually i want to find the column of bk which gives minimum value for the expression
Image Analyst
Image Analyst 2016 年 3 月 6 日
Yep, my code will do it.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by