How to write a loop to genrate vector that stores NPVs using differnet discount factors (1% to 5% with 1% increment)?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
VBBV
le 21 Fév 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!