Cody

# Problem 1132. Create a recurrence matrix for a vector of data

Solution 180606

Submitted on 21 Dec 2012 by James
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
%% v = [4 2 3 1 1 3 4 5 1 3]; real_r = [1 0 2 0 0; 0 0 1 0 0; 1 0 0 1 0; 0 1 0 0 1; 1 0 0 0 0]; real_u = 1:5; [r,u] = recurrence(v); assert(and(isequal(r,real_r), isequal(u,real_u)));

V = 1 2 3 4 5 A = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

2   Pass
%% v = [1:6,1]; real_r = circshift(eye(6),[0 1]); real_u = 1:6; [r,u] = recurrence(v); assert(and(isequal(r,real_r), isequal(u,real_u)));

V = 1 2 3 4 5 6 A = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

3   Pass
%% v = [0 0 0 0 0 0]; real_r = 5; real_u = 0; [r,u] = recurrence(v); assert(and(isequal(r,real_r), isequal(u,real_u)));

V = 0 A = 0

### Community Treasure Hunt

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

Start Hunting!