find intervals for both B and C which make the exponential function F converge to some points.

조회 수: 93 (최근 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
BURCU
BURCU 2024년 11월 20일 21:03
편집: BURCU 2024년 11월 20일 21:04
Yes, you're right. Actually, I wanted it that way, but I couldn't express it properly. How can I calculate this by using MATLAB codes?
Matt J
Matt J 2024년 11월 20일 21:18
편집: Matt J 2024년 11월 20일 21:18
Actually, I wanted it that way
Which way? Edit your original question to articulate what you really mean.

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

답변 (1개)

Walter Roberson
Walter Roberson 2024년 11월 20일 21:21
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
Walter Roberson 2024년 11월 20일 21:41
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 CenterFile 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!

Translated by