Calculating a withdrawl plan? For Loop - In an assignment A(I) = B, the number of elements in B and I must be the same. -
Show older comments
I try to calculate a withdrawl plan from a portfolio.
InitVal = 100
R_until_85 = 0.35
iNumObs = 10
iNumSim = 100
mRetRisky = [0,0194563288529693 -0,0566781000933427;
0,0492829304809960 -0,0768978197776796]
%Preallokation
mSimPrice=NaN(iNumObs,iNumSim);
this is the result i want to get:
vInitVal = repmat(InitVal,1,size(mRetRisky,2));
vR_until_85 = repmat(R_until_85,1,size(mRetRisky,2));
% vInitVal_1 = (vInitVal-vR_until_85) .* exp(mRetRisky(1,:));
% vInitVal_2 = (vInitVal_1-vR_until_85) .* exp(mRetRisky(2,:));
% vInitVal_3 = (vInitVal_2-vR_until_85) .* exp(mRetRisky(3,:));
but the Loop isn't working, where is the difference?:
for i=1:iNumObs;
vInitVal = (vInitVal-R_until_85) .* exp(mRetRisky(i,:));
mSimPrice(i) = vInitVal;
end
Cheers Thanks!!
Accepted Answer
More Answers (0)
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!