How to approximate a multivariable arctan function?
5 ビュー (過去 30 日間)
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!
回答 (1 件)
John D'Errico 2022 年 9 月 18 日
編集済み: John D'Errico 2022 年 9 月 18 日
@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))
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.