How can i write this matrix equation in matlab?

i am getting in trouble with this equation. I dont understand how can i write this upper indices? I try array but every time it gives me error. Can anyone help me?

 Accepted Answer

You need not to write the upper indices, the upper indices stand for the time step. You have to proceed like below.
A = [1/2 0 1/2 ; 0 0 1/2 ; 1/2 1 0 ] ;
x = rand(3,1) ; % initial value
t = 0:60 ; % time
X = zeros(3,length(t)) ;
X(:,1) = x ;
for i = 2:length(t)
X(:,i) = A*X(:,i-1) ;
end

1 Comment

Thank you so much! It works correctly right now :)

Sign in to comment.

More Answers (0)

Categories

Asked:

gkc
on 9 May 2017

Commented:

gkc
on 9 May 2017

Community Treasure Hunt

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

Start Hunting!