Cody

# Problem 742. Symmetric matrix

Solution 1242369

Submitted on 30 Jul 2017 by yurenchu
• Size: 10
• This is the leading solution.
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
n = 0; A_correct = []; assert(isempty(your_fcn_name(n)))

2   Pass
n = 1; A_correct = 1; assert(isequal(your_fcn_name(n),A_correct))

3   Pass
n= 3; A_correct =[1.0000 0.5000 0.3333 0.5000 1.0000 0.6667 0.3333 0.6667 1.0000] assert(isequal((your_fcn_name(n)-A_correct<1e-3),ones(n)))

A_correct = 1.0000 0.5000 0.3333 0.5000 1.0000 0.6667 0.3333 0.6667 1.0000

4   Pass
n=10 A_correct =[1.0000 0.5000 0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 0.5000 1.0000 0.6667 0.5000 0.4000 0.3333 0.2857 0.2500 0.2222 0.2000 0.3333 0.6667 1.0000 0.7500 0.6000 0.5000 0.4286 0.3750 0.3333 0.3000 0.2500 0.5000 0.7500 1.0000 0.8000 0.6667 0.5714 0.5000 0.4444 0.4000 0.2000 0.4000 0.6000 0.8000 1.0000 0.8333 0.7143 0.6250 0.5556 0.5000 0.1667 0.3333 0.5000 0.6667 0.8333 1.0000 0.8571 0.7500 0.6667 0.6000 0.1429 0.2857 0.4286 0.5714 0.7143 0.8571 1.0000 0.8750 0.7778 0.7000 0.1250 0.2500 0.3750 0.5000 0.6250 0.7500 0.8750 1.0000 0.8889 0.8000 0.1111 0.2222 0.3333 0.4444 0.5556 0.6667 0.7778 0.8889 1.0000 0.9000 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000] assert(isequal((your_fcn_name(n)-A_correct<1e-3),ones(n)))

n = 10 A_correct = 1.0000 0.5000 0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 0.5000 1.0000 0.6667 0.5000 0.4000 0.3333 0.2857 0.2500 0.2222 0.2000 0.3333 0.6667 1.0000 0.7500 0.6000 0.5000 0.4286 0.3750 0.3333 0.3000 0.2500 0.5000 0.7500 1.0000 0.8000 0.6667 0.5714 0.5000 0.4444 0.4000 0.2000 0.4000 0.6000 0.8000 1.0000 0.8333 0.7143 0.6250 0.5556 0.5000 0.1667 0.3333 0.5000 0.6667 0.8333 1.0000 0.8571 0.7500 0.6667 0.6000 0.1429 0.2857 0.4286 0.5714 0.7143 0.8571 1.0000 0.8750 0.7778 0.7000 0.1250 0.2500 0.3750 0.5000 0.6250 0.7500 0.8750 1.0000 0.8889 0.8000 0.1111 0.2222 0.3333 0.4444 0.5556 0.6667 0.7778 0.8889 1.0000 0.9000 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000

### Community Treasure Hunt

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

Start Hunting!