approximating a power law into a polynomial

119 Views Asked by At

We are trying to find the coefficients A,B and C such that x^q=A(q-1)x^2+B(q-2)x+C(q-1)(q-2), were 1<=q<=2. I have tried the matlab code below but not sure to implement constrain 1<=q<=2

clc
for l = [1 2 inf]
    alpha=1.7;
    fprintf('For norm %d\n', l)
    fprintf('Coefficients    c1    c2    c3\n')
    for n = [5 10 100]
        i = 1:n ;
        x = 0 + i/n ;
        c = [1 1 1] ;

        %Difference function that we want to minimize
        g = @(c) (alpha-1).*c(1).*x.^2 +(alpha-2).*c(2).*x ...
                +(alpha-1).*(alpha-2).*c(3) - x.^alpha;
        f_norm = @(c) norm(g(c), l) ;
        C = fminsearch(f_norm, c);
        fprintf('n = %d      ', n)
        fprintf('%f     %f\n', C(1),   C(2),    C(3))
        % Compare plot of e^x and p(x).
        p = @(x) (alpha-1).*C(1).*x.^2 +(alpha-2).*C(2).*x ...
                +(alpha-1).*(alpha-2).*C(3);
        xx = linspace(0,2,1e5);
        figure;
        plot(xx, p(xx), '--r', xx,  xx.^alpha);
        str = sprintf('Plot with n = %d, for norm %d', n,l);
        title(str,'FontSize',24)
        xlabel('x','FontSize',20)
        ylabel('y','FontSize',20)
        legend('p2 approximation','power model');
    end
end
```
1

There are 1 best solutions below

0
On

Approximate in what sense? Agrees at some selected points, minimizes e.g. the square of the difference over the ranges, ...? As stated, the problem is woefully underdetermined.

What will be the use of the approximation?

Why is the (simple!) function $x^q$ not good enough?