find intervals for both B and C which make the exponential function F converge to some points.
조회 수: 90 (최근 30일)
이전 댓글 표시
I have series Y with 258 observations.
I define new series by deleting first and last 50 observations
newY = DlnY(51:end-50);
I also define the series Y lagged 2.
logY = log(Y);
DlnY = diff(logY);
Y2 = [NaN; NaN; DlnY(1:end-2)];
I have exponential function as follows:
F = 1- exp((-B/0.009)*(Y2-C)^2)
F_func = @(B, C, Y2) 1 - exp((-B / 0.009) * (Y2 - C).^2);
The parameter c is in the range of series newY.
C = [min(newY), max(newY)];
The parameter B in the interval from 1 to infinity.
B = [1, Inf];
I) I want to find intervals for both B and C which make the function F converge to 0.
II) I want to find intervals for both B and C which make the function F converge to 0.5.
III) I want to find intervals for both B and C which make the function F converge to 1.
How can I write a MATLAB code find these intervals?
Can you please help me to write these codes. Thank you.
댓글 수: 6
답변 (1개)
Walter Roberson
대략 17시간 전
There is no point in calculating most of the F values since we are only interested in convergence. So we only test the last few values. The exact number we test is arbitrary.
F4_func = @(BC) 1 - exp((-BC(1) / 0.009) * (Y2(end-3:end) - BC(2)).^2);
targets = [0, .5, 1];
numtargets = length(targets);
bestBC = cell(numtargets,1);
for Tidx = 1 : numtargets
target = targets(Tidx);
objfun = @(BC) sum((F4_func(BC) - target).^2);
A = []; b = []; Aeq = []; beq = [];
lb = [1 min(newY)];
ub = [inf max(newY)];
nonlfunc = [];
BC0 = [2 mean(newY)];
bestBC{Tidx} = fmincon(objfun, BC0, A, b, Aeq, beq, lb, ub, nonlfunc);
end
댓글 수: 3
Walter Roberson
대략 17시간 전
celldisp(bestBC)
would be more like it.
You could probably instead use
bestBC = zeros(numtargets, 2);
%...
bestBC(Tidx,:) = fmincon(...)
I just wasn't absolutely positive that fmincon() would return vectors of values even in the case where fmincon essentially failed.
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!