フィルターのクリア

Matrix calculation + loop

1 回表示 (過去 30 日間)
Florent Rouxelin
Florent Rouxelin 2017 年 6 月 29 日
編集済み: Walter Roberson 2017 年 6 月 29 日
Does anyone knows to program the following in Matlab?
B0 [4x4]
I [4x4]
sigma [4x4]
Here is what I have so far, but this is wrong:
I = ones(4);
sigma_sum=V;
for t = 1:(T-1)
block=I;
for i = 1:t
block = (block + B0.^i)*V*(block + B0.^i)';
end
sigma_sum = sigma_sum + block;
end
Thanks for your help!

回答 (1 件)

James Tursa
James Tursa 2017 年 6 月 29 日
Maybe this is what you want:
B0 = whatever
V = whatever
sigma_sum = V;
M = eye(4); % <-- I am guessing that you really need eye(4) here instead of ones(4)
for t=1:(T-1)
M = M + B0^t; % <-- Used ^t instead of .^t here ... again I am guessing a bit here
sigma_sum = sigma_sum + M*V*M';
end

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by