MATLAB: Do I receive different results when using the PORTOPT function in the Financial Toolbox 2.2.1 (R13) than when using the Financial Toolbox 2.2 (R12.1)

6.1financial6.5differentFinancial ToolboxMATLABportoptresulttoolbox

I am trying to compute a portfolio. However, I get a row of NaN's in the output.
The following examples show this behavior:
title0 = [3655.24 3675.46 3535.84 3692.21 3972.64 4139.41 4489.18 4737.22 4789.25 4820.33 5023.15 5087.69 4159.3 ]';
title1 = [1000 1013.74 1397.15 2348.5 1609.49 1391.71 1393.2 1468.76 1608.69 1776.29 1787.69 1619.06 1364.2 ]';
title2 = [31.92 32.48 35.5 36.86 37.92 37.23 36.47 37.31 36.22 33.53 31.58 25.85 25.57 ]';
title3 = [ 1000 1013.74 1397.15 2348.5 1609.49 1391.71 1393.2 1468.76 1608.69 1776.29 1787.69 1619.06 1364.2 ]';
prices = [title0 title1 title2 title3];
returns = price2ret(prices);
returns = 100*returns;
ExpReturn = mean(returns);
ExpCovariance = cov(returns);
[resultRisk resultReturn resultWeights] = portopt(ExpReturn,ExpCovariance,100);
In 'resultRisk', the 15th row has NaN's in it (in MATLAB 6.5 (R13)).
In the above code, if I change the number of portfolios generated to be 101, the Financial Toolbox 2.2.1 (R13) does not give NaNs and the result seems correct. Is this a restriction of PORTOPT or am I doing something wrong?

Best Answer

This bug has been fixed for Release 14 (R14). For previous releases, there are no workarounds.