0
votes

I want to have a time series of 2x2 complex matrices,Ot, and I then want to have 1-line commands to multiply an array of complex vectors Vt, by the array Ot where the position in the array is understood as the time instant. I will want Vtprime(i) = Ot(i)*Vt(i). Can anyone suggest a simple way to implement this?

Suppose I have a matrix, M(t), where the elements m(j,k) are functions of t and t is an element of some series (t = 0:0.1:3). Can I create an array of matrices very easily?

I understand how to have an array in Matlab, and even a two dimensional array, where each "i" index holds two complex numbers (j=0,1). That would be a way to have a "time series of complex 2-d vectors". A way to have a time series of complex matrices would be a three dimensional array. (i,j,k) denotes the "ith" matrix and j=0,1 and k=0,1 give the elements of that matrix.

If I go a head and treat matlab like a programming language with no special packages, then I end up having to write the matrix multiplications in terms of loops etc. This then goes towards all the matrix operations. I would prefer to use commands that will make all this very easy if I can.

2
The problem is very unclear. What is dimensions of Ot? Is it a cell array of 2x2 matrices? What is class and dimensions of Vt and of each element of Vt?yuk
Could you please pose a question at a time, and be specific?user677656

2 Answers

1
votes

This could be solved with Matlab array iterations like

vtprime(:) = Ot(:)*Vt(:)

if I understand your problem correctly.

0
votes

Since Ot and Vt are both changing with time index, I think the best way to do this is in a loop. (If only one of Ot or Vt was changing with time, you could set it up in one big matrix multiplication.)

Here's how I would set it up: Ot is a complex 2x2xI 3D matrix, so that

Ot(:,:,i)

references the matrix at time instant i.

Vt is a complex 2xI matrix, so that

Vt(:,i)

references the vector at time instant i.

To do the multiplication:

for i = 1:I
    Vtprime(:,i) = Ot(:,:,i) * Vt(:,i);
end

The resulting Vtprime is a 2xI matrix set up so that Vtprime(:,i) is the output at time instant i.