How to create a simple cash flow and net investment

5 Ansichten (letzte 30 Tage)
Thomas
Thomas am 13 Apr. 2016
Kommentiert: Thomas am 14 Apr. 2016
Hi, I am trying to create several cash flows from projects that give a set annual return every year and the life of the project is 20 years and trying to create a net return on investment. I can do this easily in Excel but how would I go about it in Matlab? I've provided an example below,
%
Return_pa = [15740 17314 19045 20950 23045 30450]; % Each of these represents the return per year per project
Cost1 = [11111 12022 13024 14126 18673 20140]; % Cost per project
What I want to create from these two vectors is an array with an initial negative value for the initial cost and bring that cost forward to the next row (each representing one year) then add the Return_pa to it and bring that value forward again and add the Return_pa again for the length of 20 years (or 21 rows including year 0).
I did try initially using a for loop but I thought there might be a better way if anyone can help it would be greatly appreciated.

Akzeptierte Antwort

Roger Wohlwend
Roger Wohlwend am 14 Apr. 2016
cumsum([-Cost1; repmat(Return_pa,20,1)])

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by