PP form for the reverse function (not inverse function)

2 views (last 30 days)
Hello friends!
Consider a pp form for a set of (x,y) data points. Imagine now that we wish to find the pp form for the (x,1/y) data
points using the pp form for the (x,y) data. I am wondering whether matlab has a function which can calculate this?
Of course, I can simply calculate it indirectly but I am not sure if this is the best way to perform such a calculation
in terms of both speed and acuracy. For instance, the following do the job for the function cos(x) over [-pi/2 pi/2]:
x=-pi:0.5:pi/2;
y=cos(x);
pp=spline(x,y);
mesh=linspace(x(1),x(end),200);
pp_inv=spline(mesh,1./ppval(pp,mesh));
I seriously doubt whther my approach is efficient? (I feel not)
Any idea?
Thanks in advance!
Babak

Answers (0)

Categories

Find more on Elementary Math in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by