Cody

# Problem 2516. Element by element multiplication of two vectors

Solution 1507730

Submitted on 28 Apr 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
A=[1 2 3]; B=[1 1 1]; y_correct=[1 2 3]; assert(isequal(ele_wise(A,B),y_correct));

Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in ele_wise (line 2) z = x*y; Error in Test1 (line 4) assert(isequal(ele_wise(A,B),y_correct));

2   Fail
A=[1 2 3]; B=[1 2 3]; y_correct=[1 4 9]; assert(isequal(ele_wise(A,B),y_correct));

Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in ele_wise (line 2) z = x*y; Error in Test2 (line 4) assert(isequal(ele_wise(A,B),y_correct));

3   Fail
A=[1 8]; B=[8 1]; y_correct=[8 8]; assert(isequal(ele_wise(A,B),y_correct));

Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in ele_wise (line 2) z = x*y; Error in Test3 (line 4) assert(isequal(ele_wise(A,B),y_correct));