MATLAB: Index in position 1 is invalid. Array indices must be positive integers or logical values.

3x1 * 3x1complex numbersi jmatrices

% vectors x=[8 2 2] and y=[7 9 3], compute arrays:
% 1. a_ij=x_i y_j
% 2. b_ij=x_i/y_j
% 3. c_ij=x_i y_j then add up the elements of c. (dot product)
% 4. d_ij=x_i/(2+x_i+y_j)
% 1.
clc
close all
x = [8 2 2];
y = [7 9 3];
a(1i,1i) = x(1i,:).*y(:,1i);
disp(a)
Error in Ass1Q9 (line 16)
a(1i,1i) = x(1i,:).*y(:,1i);

Best Answer

a(1i,1i) = x(1i,:).*y(:,1i);
1i is sqrt(-1). It is never valid to use sqrt(-1) as an index. Indices must be non-negative integers.
You are expected to create a 2D array, a consisting of all possible entries of x multiplied by all possible entries of y. You are expected to use nested for loops to do that.
There are vectorized ways of doing these calculations, using implicit expansion (R2016b or later) or bsxfun()