Mathlab Code for summation equation

8 ビュー (過去 30 日間)
sha
sha 2014 年 9 月 28 日
回答済み: Karan Singh 2025 年 1 月 31 日
Hi all, How can I write matlab code for summation equation for the file attached. Pls help. Thank you guys..

回答 (1 件)

Karan Singh
Karan Singh 2025 年 1 月 31 日
Hi Sha,
It would look something like this
p_values = 1:10; % Example range of p values
T_pr = @(p, i) p * i; % Example function for T_pr
P_i = ones(1, 10) / 10; % Example probabilities summing to 1
E_Tpr = zeros(size(p_values));
for idx = 1:length(p_values)
p = p_values(idx);
E_Tpr(idx) = sum(T_pr(p, 1:10) .* P_i); % Summation
end
[~, min_idx] = min(E_Tpr);
P_optimal = p_values(min_idx);
disp(['Optimal P*: ', num2str(P_optimal)]);
Optimal P*: 1

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by