Computing IRR of a project after x years depending on price

조회 수: 1 (최근 30일)
Alexandra
Alexandra 2016년 5월 19일
편집: Alexandra 2016년 5월 19일
Hi, I am stuck trying to write a code.
I have a project of n years. The cash flow each year depends on the Price. For each year I need the internal rate of return up until then. And, I am running a monte carlo on the Price. So for each year y, I need to know the rate t for which the net present value is zero. For example: Year 1: IRR = 0 Year 2: IRR = 0 Year 3: t such that: CF0 + CF1/(1+t)^1 + CF2/(1+t)^3 = 0 .. so the end result would have to be a n*y matrix of IRR for each year and Price scenarios. Any idea how I could do this with matlab + statistics toolbox?
I am working with a code like: for a=1:y for k=1:n f = @(t,a,k)cumsum(A(k,a)/(1+t(k,a))^(a-1),2); t = fzero(f,0,optimset('display','off')); t(isnan(t)) = 0; end end
But it is not working. P.S.: This is not homework and I am not a student.
Many thanks,

답변 (0개)

카테고리

Help CenterFile Exchange에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by