Cody

# Problem 43274. Calculate correlation.

Solution 3768138

Submitted on 21 Nov 2020
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
y1=[0 1 2 3 4]' y2=-[2 3 4 5 6]' y_correct = -1; assert(isequal(mycorr(y1,y2),y_correct))

y1 = 0 1 2 3 4 y2 = -2 -3 -4 -5 -6

Undefined function 'corr' for input arguments of type 'double'. Error in mycorr (line 3) y=corr(double(y1),double(y2)); Error in Test1 (line 4) assert(isequal(mycorr(y1,y2),y_correct))

2   Fail
y1=[0 1 2 3 4]' y2=[2 3 4 5 6]' y_correct = 1; assert(isequal(mycorr(y1,y2),y_correct))

y1 = 0 1 2 3 4 y2 = 2 3 4 5 6

Undefined function 'corr' for input arguments of type 'double'. Error in mycorr (line 3) y=corr(double(y1),double(y2)); Error in Test2 (line 4) assert(isequal(mycorr(y1,y2),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!