MATLAB: Solving a complex equation

communicationMATLAB

I want to solve this equation to find a formula that computes "p" in terms of "q". Said differently, the variable is "p" and the parameter is "q".
the equation is " p.^2 .*(1-q).*(2.*q.*(1-p.^2)).^(2.*p) -2.*(1-p).*(1-q.*(1-p)).*(p+q.*(1-p))"
and there is a constraint for "p" and "q" since they are probabilities between 0 to 1
I will be so pleased if some one kindly let me know how to do it?
Thanks in advance

Best Answer

I doubt a closed form expression exists. You could solve numerically, using fzero
fun=@(p) p.^2 .*(1-q).*(2.*q.*(1-p.^2)).^(2.*p) -2.*(1-p).*(1-q.*(1-p)).*(p+q.*(1-p));
p=fzero(fun,[0,1]);
However, it is unclear to me whether multiple solutions for p might exist for a given q, even when both are constrained to [0,1]. If so, fzero will find only one of them.