I am trying to solve an equation, but I am not getting the correct value so was wondering if anyone could see my mistake.
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to solve two equations(Please read the attatched file for a better representation of what I am saying below):
- The first, which I am trying to solve for theta1 is, g(theta1) = -log(kappa)/lambda, where g(s) = 2 [ Φ(a) + (s − 1)Φ(a(1 − s)) + [exp(− a^2 /2 − (a(1 − s))^2 / 2 ]/(a√ 2π) ]− s and Φ = phi is the cumalitive normal distribution function.
- The second, which I am trying to solve for theta2 is, 1 = theta2 + (1 - kappa)/(kappa lambda h(theta2)), where h(t) = [2Φ(sigma(1-t)) - 1] and again Φ = phi is the cumalitive normal distribution function.
I have tried the following code:
beta = 1000
alpha = 467
kappa = 1 - alpha/beta % Influences the gamma* graphs, not sure how yet look at.
sigma = 4 % Appears to change the gamma graphs gradient/where it is at t = 1. It
% also changes the value of theta1 (first intersection). The
% larger the value of sigma and thus the larger the value of a,
% the closer in value theta1 is to -log(kepa)/lambda.
a = sigma/2
lambda = 3.2 % Appears to change the gamma graphs gradient/where it is at t = 1. It
% also changes the value of theta1 (first intersection).
b = -log(kappa)/lambda
Calculating θ_1 :
syms theta1
gtheta1 = 2*(normcdf(a) + (theta1 - 1) * normcdf(a*(1-theta1)) + 1/(a*sqrt(2*pi)) * (exp(-(a.^2)/2) - ...
exp(-(a.^2*(1-theta1).^2)/2))) - theta1 == b;
soltheta1 = vpasolve(gtheta1, theta1)
w = round(soltheta1, 3);
w1 = w + 0.001;
w2 = 1000 * w1;
w3 = (w + 0.002) * 1000;
Calculating θ_2:
syms theta2
gtheta2 = theta2 + (1 - kappa)/(kappa * lambda * (2*normcdf(sigma*(1 - theta2) / 2 ) - 1)) == 1;
soltheta2 = vpasolve(gtheta2, theta2)
w = round(soltheta2, 3);
x = w + 0.001;
y = 1000 * x;
z = (w + 0.002) * 1000;
Note that the answers should be, theta1 = 0.175 and theta2 = 0.85
4 件のコメント
Paul
2022 年 8 月 27 日
Perhaps double check the equation in Q1 of the attached pdf and/or the constants beta, alpha, and sigrma. A plot shows two roots, one at ~0.2128 and another at ~1.785
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!