having trouble optimizing a NPV

13 ビュー (過去 30 日間)
jxl
jxl 2022 年 10 月 21 日
回答済み: Sam Chak 2022 年 10 月 21 日
So I am trying to find the optimization for r, however i can never get yval to equal 0
rinit=0.05;
[npvmin,yval]=fminsearch(@tsk,rinit);
function [npv]=tsk(r)
outlay=1000;
t=[0.25;0.5;0.75;1;1.25;1.5];
cf=[250;100;150;200;250;200];
asx = cf./((1+r).^t);
npv=sum(asx);
end

回答 (1 件)

Sam Chak
Sam Chak 2022 年 10 月 21 日
Hi @jxl
The function tsk(r) seems to be converging asymptotically to zero as .
r = linspace(0, 1000, 10001);
plot(r, tsk(r)), grid on, xlabel('r')
rinit = 0.05;
[npvmin, yval] = fminsearch(@tsk, rinit)
Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: 0.000033
npvmin = 3.1691e+27
yval = 3.3320e-05
function [npv] = tsk(r)
outlay = 1000;
t = [0.25; 0.50; 0.75; 1.00; 1.25; 1.50];
cf = [250; 100; 150; 200; 250; 200];
asx = cf./((1 + r).^t);
npv = sum(asx);
end

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by