Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Question regarding Symbolic math toolbox

Subject: Question regarding Symbolic math toolbox

From: drgz

Date: 27 Aug, 2009 13:01:23

Message: 1 of 4

Just got a small question regarding the result after using the finverse() function from the Symbolic ath Toolbox.

I'm want to find the inverse function f(x)^(-1) of f(x), which is the approximation of a Pin/Pout curve for an amplifier (used polyfit() to find the coefficients).

p = polyfit(Pin,Pout,n); %Fit and invert curve for Pin vs. Pout
f = polyval(p,Pin);
syms x
fx = p(1)*x^5+p(2)*x^4+p(3)*x^3+p(4)*x^2+p(5)*x+p(6);
g = finverse(fx, x);

The last line gives the output:

g = RootOf(X1^5 - (7491982768887505*X1^4)/7959406428844147 + (5364834080844069*X1^3)/15918812857688294 - (7239056818688443*X1^2)/127350502861506352 + (4547589339036133*X1)/1018804022892050816 - (68719476736*x)/7959406428844147 - 4939238748794939/8346042555531680284672, X1)

My question; what is X1 here?

If I find the inverse function of any other "known" function, f(x) (i.e tan(x)), the output is given as a function of x, and not another variable.

Example:

fx = tan(x);
g = finverse(fx, x); => g = atan(x)

Hope anyone can help :)

And if possible, I'm also open for better/more efficient ways of finding the inverse function.

drgz

Subject: Question regarding Symbolic math toolbox

From: Steven Lord

Date: 27 Aug, 2009 13:28:04

Message: 2 of 4


"drgz " <syrehue@hotmail.com> wrote in message
news:h76033$82s$1@fred.mathworks.com...
> Just got a small question regarding the result after using the finverse()
> function from the Symbolic ath Toolbox.
>
> I'm want to find the inverse function f(x)^(-1) of f(x), which is the
> approximation of a Pin/Pout curve for an amplifier (used polyfit() to find
> the coefficients).
>
> p = polyfit(Pin,Pout,n); %Fit and invert curve for Pin vs. Pout
> f = polyval(p,Pin);
> syms x
> fx = p(1)*x^5+p(2)*x^4+p(3)*x^3+p(4)*x^2+p(5)*x+p(6);
> g = finverse(fx, x);
>
> The last line gives the output:
>
> g = RootOf(X1^5 - (7491982768887505*X1^4)/7959406428844147 +
> (5364834080844069*X1^3)/15918812857688294 -
> (7239056818688443*X1^2)/127350502861506352 +
> (4547589339036133*X1)/1018804022892050816 -
> (68719476736*x)/7959406428844147 -
> 4939238748794939/8346042555531680284672, X1)
>
> My question; what is X1 here?

If FINVERSE can't determine the inverse of your function (or your function
doesn't have an inverse) and your function is a polynomial, it will return a
RootOf expression, as described in this section from the M-file help of
FINVERSE in release R2009a.

    If no inverse can be found g is either the empty sym object
    or, if f is a polynomial, a RootOf expression.

The X1 inside that RootOf expression is a "dummy variable" -- the polynomial
inside the RootOf expression needed to be expressed in terms of a variable,
so it chose an arbitrary name that wasn't being used in the toolbox.

> If I find the inverse function of any other "known" function, f(x) (i.e
> tan(x)), the output is given as a function of x, and not another variable.

That's because FINVERSE can find the inverse of tan(x) -- but your function
may not have an inverse. I took the data you posted above and I believe I
reconstructed your fx function. I then used EZPLOT to examine your function
and when I zoomed in to look at the section around X1 = 0.05 to X1 = 0.3 I
found multiple X1 values that resulted in the same value of Y. That means
your function is not invertible.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Question regarding Symbolic math toolbox

From: drgz

Date: 27 Aug, 2009 13:50:20

Message: 3 of 4

I somehow have missed that part when reading about the function. Thanks for clarifying!

Subject: Question regarding Symbolic math toolbox

From: John D'Errico

Date: 27 Aug, 2009 14:03:19

Message: 4 of 4

"drgz " <syrehue@hotmail.com> wrote in message <h76033$82s$1@fred.mathworks.com>...
> Just got a small question regarding the result after using the finverse() function from the Symbolic ath Toolbox.
>
> I'm want to find the inverse function f(x)^(-1) of f(x), which is the approximation of a Pin/Pout curve for an amplifier (used polyfit() to find the coefficients).
>
> p = polyfit(Pin,Pout,n); %Fit and invert curve for Pin vs. Pout
> f = polyval(p,Pin);
> syms x
> fx = p(1)*x^5+p(2)*x^4+p(3)*x^3+p(4)*x^2+p(5)*x+p(6);
> g = finverse(fx, x);
>
> The last line gives the output:
>
> g = RootOf(X1^5 - (7491982768887505*X1^4)/7959406428844147 + (5364834080844069*X1^3)/15918812857688294 - (7239056818688443*X1^2)/127350502861506352 + (4547589339036133*X1)/1018804022892050816 - (68719476736*x)/7959406428844147 - 4939238748794939/8346042555531680284672, X1)
>
> My question; what is X1 here?
>
> If I find the inverse function of any other "known" function, f(x) (i.e tan(x)), the output is given as a function of x, and not another variable.
>
> Example:
>
> fx = tan(x);
> g = finverse(fx, x); => g = atan(x)
>
> Hope anyone can help :)
>
> And if possible, I'm also open for better/more efficient ways of finding the inverse function.
>
> drgz

You want to find the solution of a 5th degree polynomial.
IT DOES NOT EXIST IN ANALYTICAL FORM FOR A GENERAL
POLYNOMIAL.

You may want it, but wishing for something does not
make it so. (Unless you are the possessor of a pair of
ruby shoes.)

John

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us