Cody

Problem 44950. Calculate Inner Product

Solution 2557068

Submitted on 15 Jun 2020 by Zane Maggio
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   Pass
x = [1 2]; y = [2;3]; z_correct = 8; assert(isequal(in_prod(x,y),z_correct))

xx = 1 xy = 2 yx = 2 yy = 1 z = 8

2   Pass
x = -5; y = 100; z_correct = -500; assert(isequal(in_prod(x,y),z_correct))

xx = 1 xy = 1 yx = 1 yy = 1 z = -500

3   Pass
x = [1 2 3]; y = [2;3]; assert(isStringScalar(in_prod(x,y)))

xx = 1 xy = 3 yx = 2 yy = 1 z = "Inner dimensions do not match"