% Recently, I have to deal with serious issue with investment. % This program helps me understand more about the risk involved! capital = 100; % assume that I start with 100 SGD lowGain = 10; lowLose = 2; highGain = 100; highLose = 50; lowRisk(1) = capital; % I start with the same money on year 1! highRisk(1) = capital; normalSaving(1) = capital; rand('state',0); % I force the sequence of random numbers to be the same every time! for time = 2:25; lowRisk(time) = lowRisk(time-1) + rand() * lowGain - lowLose; highRisk(time) = highRisk(time-1) + rand() * highGain - highLose; normalSaving(time) = 1.025 * normalSaving(time-1); % just 2.5 percent every year end % We have the data. % Now, plot it :) % bla bla bla...