Hi there. There are a number of issues with this piece of code.

The first, as you point out, is with MATLAB's inability to compute the product you are requestion. The reason for this is that cos(t) for t= 0:0.1:10 is a vector with 101 elements, whilst both I and s3 are 2x2 matrices, and so matlab cannot multiply them together. I can see that you'd tried to solve this problem by using .* instead of *, but .* means 'multiply each element of the first matrix with each element of the second', but that only works for matrices of the same size.

To solve this problem, I would use a for loop where the single value of t changes at every iteration.

The second problem I can see is that your equation gives a vector as an output, as you were expecting. However, you can't assign a vector value to an array variable.

By that I mean, if you say x(1) = [5;2];, matlab will give you an error, because you can only assign single values to x(1), e.g. x(1) = 5. So you have a problem in storing your solutions. I suggest storing them in cells instead of in an array, so you would simply use square brackets instead of normal brackets.

Finally, as x will be a variable containing 101 vector solutions, how do you expect matlab to plot it? The plot function takes a vector of single values and plots it against another vector of single values - it cannot deal with variables whose values are vectors, and so you will need to find another way to display your results, depending on precisely what it is that you want to display.

Given these problems, I suggest you write the code like so:

I = [1 0; 0 1];

s_1 = [0 1; 1 0];

s_2 = [0 -1i; 1i 0];

s_3 = [1 0; 0 -1];

x = cell(101,1); %this initialises the size of the cell, which saves time

i = 0; % this starts a counter, which will allow to store data at each iteration of the for loop

for t = 0:0.1:10; %a for loop where t changes upon every iteration

i = i+1; % add 1 to the counter

x{i} = (expm(cos(t).*I + 1i.*cos(t).*s_3) )*[1;2]; % store the vector-valued solution in cell 1 of the cell array x

end % end the for loop

If you explain to me what it is that you want to ploy, I might be able to help.