Is it possible to "invert" a series of data like when a function is inverted?
Let me explain. If I have a function that I can plot in MATLAB, I can always (almost) find the inverse of such function with the finverse
and the plot would provide this:
But I do not have the a function for my data, and I would still like to find a sort of inverse of such series of data, like for example y=f(x)
where
x=[0.0050879 0.0056528 0.0062176 0.0067822 0.0073467 0.0079111 0.0084752 0.0090392 0.0096030 0.0101666 0.0107299 0.0112930 0.0118558 0.0124184 0.0129807 0.0135428 0.0141045 0.0146659 0.0152270 0.0157877 0.0163481];
and
y=[0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 4.4901e-05 4.4901e-05 8.9801e-05 1.3470e-04 1.7960e-04 2.2450e-04 2.6940e-04 3.5920e-04 4.0411e-04 4.9391e-04 5.8371e-04];
Is this kind of operation on a series of data possible in MATLAB? Is there a technique/method/function that handles this?
NOTE: I previously tried to "fit" the series of data with a polynomial via the polyfit
function and then invert it via the finverse
function; but it results in an f^-1
function that is dependent on both x
and y
at the same time. And because x
is not even spaced homogeneously, I do not even know how to plot it...
Since the inverse of a function is simply the reflection of the function about axis y=x, you can achieve this by transformation.
Update
I was so into transformation...Then I found the transformation matrix is simply
which is basically swapping x and y....and yes, that is the fundamental thing about the inverse of a function.
So simply:
and yes, a blow to my pride, @m7913d's answer is much simpler.
Inverting a function represented by a series of
(x, y)
data points is done by changing the position ofx
andy
:(y, x)
. This can be visualised in Matlab as follows: