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 个评论
BURCU
BURCU about 17 hours 前
编辑:BURCU about 13 hours 前
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 about 17 hours 前
编辑:Matt J about 17 hours 前
Actually, I wanted it that way
Which way? Edit your original question to articulate what you really mean.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson about 12 hours 前
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 about 16 hours 前
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