Need help writing a code for a matrix with iteration

I need help to write a Matlab code. I am quite the beginner so have very limited knowledge of matlab. Although my post will be relatively long I don't think the code itself should be that long.
The problem is as follows:
X(t) = AX(t-1)
Where X(t) is a column vector consisting of elements X1(t), X2(t), X3(t) and X4(t). Matrix A is the matrix in the image at the bottom of this post and X(t-1) is a column vector consisting of elements X1(t-1), X2(t-1), X3(t-1) and X4(t-1).
So the multiplication of matrix A with column vector X(t-1) yields us X(t) [which is what comes after X(t-1)]. Essentially, matrix A is used to help yield a prediction of the next state [i.e. X(t)].
All the elements in matrix A are constants apart from the the element A31; due to the fact this element contains an 'Act' term. The value of Act (which represents activity) depends on the subject tested (I have the Act values for each subject).
Since X(t) = AX(t-1)
then X(1) = AX(1-1) = AX(0), X(2) = AX(2-1) = AX(1) = A[AX(0)]*, X(3) = AX(3-1) = AX(2) = A(A(AX(0))).
So general form X(k) = A^k(X(0)).
As you can see, it's an iteration (or recurrence? not sure of the term), where the previous result becomes the input (alongside Matrix A) to calculate the next state. Could anyone help me write a code that basically draws the 'Act' value from a column of data, feeds it into matrix A, multiplies the matrix A by X(t-1) to yield X(t) and then this result is fed into the next iteration [i.e. X(t+1) = AX(t)] as well as the new Act value from data and so on and on?
Hope I made that clear. Thanks.

Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Asked:

on 10 Feb 2016

Edited:

on 10 Feb 2016

Community Treasure Hunt

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

Start Hunting!