How do I take the following equation and put it into Matlab form?

2 ビュー (過去 30 日間)
sree chak
sree chak 2020 年 9 月 3 日
回答済み: Walter Roberson 2020 年 9 月 3 日
I am trying to evaluate an objective function and trying to figure out how to translate this into Matlab form.
I know I have to do a loop somewhere but just can't figure out how to start. Any guidance would be really really appreciated.
Essentially k = 1: 5 and j = 1:J and n = 1:N
  3 件のコメント
David Hill
David Hill 2020 年 9 月 3 日
Where does Pj fit into the equation?
sree chak
sree chak 2020 年 9 月 3 日
Thank you for the question. You can ignore the Pj.

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 9 月 3 日
abs(Gkj - sum(f(c(1:N)) .* gkj(X(1:N))))
provided that f and gkj are vectorized functions.
If they are not, then
fv = @(C) arrayfun(@f, C);
gkjv = @(C) arrayfun(@gkj,C);
abs(Gkj - sum(fv(c(1:N)) .* gkjv(X(1:N))))

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by