Matrix calculation + loop

1 view (last 30 days)
Florent Rouxelin
Florent Rouxelin on 29 Jun 2017
Edited: Walter Roberson on 29 Jun 2017
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!

Answers (1)

James Tursa
James Tursa on 29 Jun 2017
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

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!