Cody

Problem 742. Symmetric matrix

Solution 97869

Submitted on 12 Jun 2012
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
%% n = 0; A_correct = []; assert(isempty(your_fcn_name(n)))

Error: Output argument "A" (and maybe others) not assigned during call to "/users/msssystem7/your_fcn_name.m>your_fcn_name".

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

3   Fail
%% 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)))

Error: Assertion failed.

4   Fail
%% 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)))

Error: Assertion failed.