Cody

Problem 43274. Calculate correlation.

Solution 1006458

Submitted on 10 Oct 2016 by deoksu kim
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
y1=[0 1 2 3 4]' y2=[2 3 4 5 6]' y_correct = sum((y1-mean(y1)).*(y2-mean(y2)))/sqrt(sum((y1-mean(y1)).^2)*sum((y2-mean(y2)).^2)); assert(isequal(your_fcn_name(y1,y2),y_correct))

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

Suggested Problems

More from this Author27

Community Treasure Hunt

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

Start Hunting!