How to write a loop to genrate vector that stores NPVs using differnet discount factors (1% to 5% with 1% increment)?
조회 수: 1 (최근 30일)
이전 댓글 표시
Period Cash_Flow
1 155.37
2 5.2
3 78.21
4 4.05
5 21.99
6 17.29
7 64.69
8 222.42
9 60.89
10 151.39
How to write a loop to genrate vector that stores NPVs using differnet discount factors (1% to 5% with 1% increment)?
댓글 수: 0
채택된 답변
VBBV
2022년 2월 21일
Initial = 200; % initial investment
D = [
1 155.37
2 5.2
3 78.21
4 4.05
5 21.99
6 17.29
7 64.69
8 222.42
9 60.89
10 151.39];
r = 0.01:0.01:0.05; % discount rate
for k = 1:size(D,1)
PVDCF(k,:) = D(k,2)./(1+r).^D(k,1);
end
PVDCF
PV = sum(PVDCF) % sum present value for each discount rate
NPV = sum(PVDCF) - Initial % NPV for each discount rate
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!