Computing IRR of a project after x years depending on price
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!