Cody

Problem 44421. Portfolio diversification: choose your stocks !

Solution 1363610

Submitted on 30 Nov 2017
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   Fail
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(x),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'}

Undefined function or variable 'x'. Error in Test1 (line 5) assert(isequal(your_fcn_name(x),y_correct))

2   Fail
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(x),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'}

Undefined function or variable 'x'. Error in Test2 (line 5) assert(isequal(your_fcn_name(x),y_correct))

3   Fail
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(x),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'}

Undefined function or variable 'x'. Error in Test3 (line 5) assert(isequal(your_fcn_name(x),y_correct))

Suggested Problems

More from this Author12

Community Treasure Hunt

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

Start Hunting!