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)?

채택된 답변

VBBV
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
PVDCF = 10×5
153.8317 152.3235 150.8447 149.3942 147.9714 5.0975 4.9981 4.9015 4.8077 4.7166 75.9099 73.6990 71.5732 69.5284 67.5607 3.8920 3.7416 3.5984 3.4620 3.3319 20.9227 19.9170 18.9688 18.0742 17.2297 16.2880 15.3530 14.4801 13.6645 12.9021 60.3375 56.3165 52.5989 49.1591 45.9740 205.4011 189.8333 175.5804 162.5201 150.5426 55.6742 50.9500 46.6671 42.7805 39.2502 137.0514 124.1925 112.6484 102.2737 92.9403
PV = sum(PVDCF) % sum present value for each discount rate
PV = 1×5
734.4060 691.3247 651.8614 615.6644 582.4196
NPV = sum(PVDCF) - Initial % NPV for each discount rate
NPV = 1×5
534.4060 491.3247 451.8614 415.6644 382.4196

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by