Dear all
I am a Geophysicist and I have the geophysics problem that I make it into math model using Convex Optimization. I have a fractional function f(X,n) in the form numerator and denominator ( f(X,n) = N/D) which numerator defined as:
N = 1 + (2n+1)X^2 + (n^2 + 2n)*X^4 + X^6
denominator D = 1 + (4n+3)X^2 + (n^2 + 3n)*X^4 + (n^3 + 4n)*X^6 + (n + 6)*X^8
I want to reduce f(X,n) into lower order that is new fraction function, let me define g(X,n) = P/Q, which
P = 1 + a1X + a2X^2 + a3X^3 + a4X^4
Q = 1 + b1X + b2X^2 + b3X^3 + b4X^4
The constraint, I set only n = 0.5
and 0 =< X =< 3 (interval 0.05)
abs(f(X,n) - g(X,n)) < 10e-6
I need the solution for single a1,a2,…b1,b2…b4
The MATLAB code that I make:
Tpowers=[ones(length(X),1) X X.^2 X.^3 X.^4];
u = max(f); % here f = f(X,n)
l = 0;
bisection_tol=1e-6; % bisection tolerance
while u-l>= bisection_tol
gamma=(l+u)/2;
cvx_begin % solve the feasibility problem
cvx_quiet(true);
variable A(4);
variable B(4);
subject to
abs(Tpowers*[1;A]-y.(Tpowers[1;B]))<=gammaTpowers[1;B];
cvx_end
if strcmp(cvx_status,‘Solved’)
u=gamma;
a_opt = a;
b_opt = b;
objval_opt = gamma;
else
l=gamma;
end
end
y_fit = Tpowers*[1;a_opt]./(Tpowers*[1;b_opt]);
The code above is well done, and now I am going to make n variable will be constraint also
where: 0 =< n=< 0.5 (interval 0.1)
and there are a looping process:
when n = 0 --> for X = 0 to 3
n = 0.1 --> for X = 0 to 3
n = 0.2 --> for X = 0 to 3
…
n = 0.5 --> for X = 0 to 3
Even though the n varies with fixed X = 0 to 3, I need only single a1,a2,a3,a4,b1,b2,b3, and b4
So when I obtain a1,a2,…b4 it will be valid for whole n (n = 0 to 0.5)
Could anyone help me to give this solution.
I highly appreciate your help
Thank you