How to get the inverse function when it's only 1-1 in certain range?

3 views (last 30 days)
I have a function f which is not one to one globally, but it is so on [0,1]. Now I want to compute the inverse function g of f on [0,1]. But finverse gives me the part on the range I don't need. How to deal with it? Below is the example:
phi=@(m,z)m*z^(m-1)-(m-1)*z^(m);
phi2=@(z)phi(2,z);
iphi2=matlabFunction(finverse(phi2(z)))

Answers (2)

Star Strider
Star Strider on 8 Apr 2016
I would just use fzero instead.
If ‘phi_d’ is your desired value and you want to see what value of ‘z’ produces it, this works:
phi_d = 0.5;
z_inv = fzero(@(z) phi2(z)-phi_d, 0.1);
Here, ‘z_inv’ is about 0.293.

Roger Stafford
Roger Stafford on 8 Apr 2016
As you have defined iphi2 it is simply one of the two solutions to a quadratic equation:
z = 1-sqrt(1-phi2)

Community Treasure Hunt

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

Start Hunting!