Find inverse of a function

5 views (last 30 days)
khu
khu on 1 Jun 2016
Hello Everyone,
I have a function defined in m file. As finverse only work for symbolic expressions, I was wondering if there is any way to find the inverse of a user defined function.
  3 Comments
Pavel Dey
Pavel Dey on 6 Jun 2016
Seems there is no direct way of doing it. You will have to find it manually. To get the zeros of a function you may use 'fzero' function.
Prasidh Ramabadran
Prasidh Ramabadran on 6 Jun 2016
If your function is a polynomial expressed in powers of x, one of the ways to find the co-efficients of powers of x could be the usage of the backslash '\'operator. You would be able to solve your curve fitting equation without finding the inverse. This would application specific. Let me give you an example:
Consider, a non-linear amplifier device with some known set of input and output powers. Now, power is proportional to the square of the voltage. Estimating the voltage gain of the amplifier would require multiplying the inverse of the input voltage matrix ( calculated from input power data) with the output voltage matrix (calculated from the output power data). This could be done using the back-slash function. The output voltage for each input voltage could be expressed in the form a.x + b.x^2 + c.x^3 where a,b and c are the gain co-efficients corresponding to the input voltage, its square and cube. Let this be a column matrix in the form A=[a; b; c]. Make an input matrix of the form X=[x1 x1^2 x1^3; x2 x2^2 x2^3; ............]. Make an output matrix of the form Y = [y1; y2; ................].
Your task would now be to find the co-efficient matrix 'A'. The conventional way of doing this would be to multiply matrix 'Y'with inverse of 'X'. You could solve this using backslash operator as A = X\Y; The matrix A will give you the values of a, b and c for each input value of x that yields an output value of y.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!