This is my code. It keeps giving an error that Index exceeds matrix dimensions.
function [y_out] = my_dot(x,y)
%for finding the inner product or dot product of two arrays
%first need to know the size
[m_x,n_x] = size(x);
[m_y,n_y] = size(y);
%ensure is row or column vectors of equal length
if(m_x ~= 1 && n_x ~=1)  (n_y ~= 1 && n_y ~= 1)
y_out = 'Failed';
return
end
%determine if x and y are column or row vectors
%both should be column vectors
if (m_x == 1  m_y ==1) %they are row vectors
y_out = 'Failed';
return
end
%make sure x and y are the same size
if n_x ~= n_y
y_out = 'Failed';
return
end
%now do the dot product
for i = 1:m_x
y = sum(x(i,1) * y(i,1));
y_out = y;
end
end
this is what I get
>> my_dot([1;1],[2;3])
Index exceeds matrix dimensions.
Error in my_dot (line 26)
