Your turn Write the function la pade1finmx1x2 that generates
Your turn: Write the function, la, pade1(fin,m,x1,x2), that generates the Padé coefficient vectors a and b for the rational function approximation, f(x). Also, it should generate a plot displaying f(x) and f (x) for x E [x1 x2]. n and m are the order of the numerator and denominator of f(x), respectively. f represents the (anonymous function) f(x) being approximated. Note: Your function pade1 should generate internally the required Maclaurin polynomial coefficients (Taylor series applied at the origin). You must not use the built-in Matlab function pade, i e., your program is supposed to generate the required system of (m n 1)x(m n 1) equations and solve it Test your function for f (x) tan (x), with n 5 and m 4 and [x1 x2] [-3 3].
Solution
ans = pi*k - asin(3^(1/2)/3) asin(3^(1/2)/3) + pi*k ans = 2*pi*k - 2*asin(3^(1/2)/3) 2*asin(3^(1/2)/3) + 2*pi*k ans = in(k, \'integer\') in(k, \'integer\') ans = k