My proffesor gave use this script but i can not seem to understand what it means.
for i=1:3;
% Initialisation pour chaque obligation
t=sems(i); c=cpns(i); p=VO(i); g=tauxZC2(sems(i))/2;
% Definition de la fonction à minimiser
fun = @(x)(c/x*(1-1/(1+x)^t)+VN/(1+x)^t-p)^2;
% Minimisation avec taux spot comme premier guess
x0=g;
[xmin, fval]=fmincon(fun,x0);
Y(i)=xmin*2;
end
% OUTPUTS TRE en composition semestrielle
format long
Y

 채택된 답변

Torsten
Torsten 2023년 2월 8일
편집: Torsten 2023년 2월 8일

0 개 추천

What is VN ? Where is the function "tauxZC2" ?
As written, the code tries to find a value of x that minimizes (c/x*(1-1/(1+x)^t)+VN/(1+x)^t-p)^2 for given values of c, t, VN and p.
And don't let your professor see that he/she is your proffesor.

댓글 수: 1

Charlotte Simard
Charlotte Simard 2023년 2월 8일
The VN is the nominal value and the tauxZC2 is not a function but a variable calculated earlier in the script.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
Matt J 2023년 2월 8일
편집: Matt J 2023년 2월 8일

0 개 추천

It means minimize fun(x) over x for each set of fixed parameters t,c,p,VN. The initial guess for the minimization is g. The minimizing point is xmin and Y(i) will store twice the result, 2*xmin.

카테고리

도움말 센터File Exchange에서 Transportation Engineering에 대해 자세히 알아보기

질문:

2023년 2월 8일

댓글:

2023년 2월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by