Cody

# Problem 44421. Portfolio diversification: choose your stocks !

Solution 1363614

Submitted on 30 Nov 2017 by jean claude
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
stock1=[0.1 0.3 0.22 -.15 ] stock2=[0.3 0.4 -0.13 -0.22 ] stock3=[0.6 -0.3 0.44 0.05] y_correct ={'stock2' 'stock3'} assert(isequal(your_fcn_name(stock1,stock2,stock3),y_correct))

stock1 = 0.1000 0.3000 0.2200 -0.1500 stock2 = 0.3000 0.4000 -0.1300 -0.2200 stock3 = 0.6000 -0.3000 0.4400 0.0500 y_correct = 1×2 cell array {'stock2'} {'stock3'} a = 1.0000 0.6242 -0.1408 0.6242 1.0000 -0.2070 -0.1408 -0.2070 1.0000 b = 1.0000 0 0 0.6242 1.0000 0 -0.1408 -0.2070 1.0000 i = 3 j = 2 c = 2 3 y = 1×2 cell array {'stock2'} {'stock3'}

2   Pass
stock1=[-0.1 0.4 -0.14 -.32 ] stock2=[0.35 -0.10 0.66 0.18 ] stock3=[0.62 -0.3 0.44 0.05] y_correct = {'stock1' 'stock2'} assert(isequal(your_fcn_name(stock1,stock2,stock3),y_correct))

stock1 = -0.1000 0.4000 -0.1400 -0.3200 stock2 = 0.3500 -0.1000 0.6600 0.1800 stock3 = 0.6200 -0.3000 0.4400 0.0500 y_correct = 1×2 cell array {'stock1'} {'stock2'} a = 1.0000 -0.6162 -0.5974 -0.6162 1.0000 0.8307 -0.5974 0.8307 1.0000 b = 1.0000 0 0 -0.6162 1.0000 0 -0.5974 0.8307 1.0000 i = 2 j = 1 c = 1 2 y = 1×2 cell array {'stock1'} {'stock2'}

3   Pass
stock1=[0.3 0.4 -0.8 0.5 ] stock2=[0.62 0.2 -0.3 0.05] stock3=[0.35 -0.10 0.66 0.18 ] y_correct = {'stock1' 'stock3'} assert(isequal(your_fcn_name(stock1,stock2,stock3),y_correct))

stock1 = 0.3000 0.4000 -0.8000 0.5000 stock2 = 0.6200 0.2000 -0.3000 0.0500 stock3 = 0.3500 -0.1000 0.6600 0.1800 y_correct = 1×2 cell array {'stock1'} {'stock3'} a = 1.0000 0.6847 -0.8342 0.6847 1.0000 -0.4052 -0.8342 -0.4052 1.0000 b = 1.0000 0 0 0.6847 1.0000 0 -0.8342 -0.4052 1.0000 i = 3 j = 1 c = 1 3 y = 1×2 cell array {'stock1'} {'stock3'}