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

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)

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.
As you have defined iphi2 it is simply one of the two solutions to a quadratic equation:
z = 1-sqrt(1-phi2)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Asked:

on 8 Apr 2016

Answered:

on 8 Apr 2016

Community Treasure Hunt

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

Start Hunting!