How to approximate a multivariable arctan function?

13 views (last 30 days)
Hi,
let the following function be given:
Is there a way in Matlab to approximate this function as a multivariable (x1,x2,x3,u1) rational polynomial?
lv and bv are positive constants.
x2 should be defined within -pi/4 and pi/4 [rad].
x3 should be defined within (-pi/4) and (pi/4) [rad/sec].
x1 > 0 [meter/sec].
u1 should be defined within (-pi/12) and (pi/12) [rad].
Thanks a lot in advance!
  19 Comments
Torsten
Torsten on 23 Sep 2022
Edited: Torsten on 23 Sep 2022
No, in the same way as the rational polynomials in MATLAB are defined - by setting p(10) = 1 and fitting only 9 parameters.
Note that if p(1),...,p(10) is a solution for the Least-squares problem, then also p(1)*c,p(2)*c,...,p(10)*c is a solution for every constant c not equal to 0. This is prohibited by normalizing one of the parameters to 1.
Jannis Erz
Jannis Erz on 24 Sep 2022
Thanks for the explanation! Really appreciate it!

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 18 Sep 2022
Edited: John D'Errico on 18 Sep 2022
@Sam Chak has suggested an interesting idea in a comment. However, while it is not a bad idea at first glance, I suspect it will be problematic. The issue is, that classic atan series is not very strongly convergent. Expect to need many terms before you get anything good. And that means the polynomial approximation will be poor at best.
For example, how many terms do you need for convergence as a function of x to k significant digits, in the simple atan series?
For example, when x == 1, how many terms are required? We can look at it easily, since that is just the Leibniz formula for pi/4. Thus...
N = 0:1000;
S = mod(N+1,2)*2 - 1;
approx = cumsum(S./(2*N+1));
truth = pi/4;
semilogy(N,abs(approx - truth))
grid on
So we need thousands of terms for convergence near x==1.
However, if you can use range reduction methods to force the argument x to the atan to be in a small interval near zero, you get much faster convergence. The problem is, that in itself may take some work, and it is not at all trivial to get good convergence.
Instead, you may gain from using a direct rational polynomial approximation, perhaps something like those found in the classic, by JF Hart, et al, "Computer Approximations". (Start reading around page 120 in my edition from 1978. The tables there give some pretty good approxmations, though they still employ range reduction.)
Note: Even though Hart is an old text, it is still a book I love dearly, but that might apply only to a real gearhead numerical analyst like me. I think I recall it is available as a Dover reprint.
  7 Comments
Bruno Luong
Bruno Luong on 19 Sep 2022
Yes, Padé fractional series is my loosly wording, rather use Padé approximant please.
Sam Chak
Sam Chak on 19 Sep 2022
Found the pade() command. Maybe @Jannis Erz can work out the desired Rational Polynomial function.
help \sym\pade
PADE approximation of a symbolic expression PADE(f <, x> <,options>) computes the third order Pade approximant of f at x = 0. If x is not given, it is determined using symvar. PADE(f, x, a <, options>) computes the third order Pade approximant of f at x = a. A different order can be specified using the option 'Order' (see below). The following options can be given as name-value pairs: Parameter Value 'ExpansionPoint' a Compute the Pade approximation about the point a. It is also possible to specify the expansion point as third argument without explicitly using a parameter value pair. 'Order' [m, n] Compute the Pade approximation with numerator order m and denominator order n. 'Order' m Compute the Pade approximation with both numerator and denominator order equal to m. By default, 3 is used. 'OrderMode' 'Absolute' or 'Relative'. If the order mode is 'Relative' and f has a zero or pole at the expansion point, add the multiplicity of that zero to the order. If f has no zero or pole at the expansion point, this option has no effect. Default is 'Absolute'. Examples: syms x pade(sin(x)) returns (60*x - 7*x^3)/(3*(x^2 + 20)) pade(cos(x), x, 'Order', [1, 2]) returns 2/(x^2 + 2) See also TAYLOR. Documentation for pade doc pade

Sign in to comment.

Categories

Find more on Polynomials in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!