How to write a loop to genrate vector that stores NPVs using differnet discount factors (1% to 5% with 1% increment)?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
VBBV
il 21 Feb 2022
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!