MATLAB: Aiming to solve function and have one of the variables be a minimum value:

function and equationMATLAB

syms r x
a = 100;
Cp = .70;
b = .50206;
c = 67.402;
d = 1.2;
e = .0277777778;
eqn = ((100*Cp*x)-(b*x*r*r))/((100*Cp*x)-(c/r)-(b*x*r*r)) == exp(d*acos(e*r));
solx = solve(eqn, x)
[r, fval] = fminsearch(matlabFunction(solx),[1 1])
So I know the last part is wrong. But I am given the "eqn" and I want X to be a minimum value. I am not sure which matlab method I should use to make this happen. I tried to use fminsearch, but it refuses to solve it that way, and I was wondering if theres another method I am unaware of. The r value can be variable and what it ends up being isn't important to me.
Thanks!

Best Answer

The key point here is to define solx as a function of r. Try the following code:
syms r x
a = 100;
Cp = .70;
b = .50206;
c = 67.402;
d = 1.2;
e = .0277777778;
eqn = ((100*Cp*x)-(b*x*r*r))/((100*Cp*x)-(c/r)-(b*x*r*r)) == exp(d*acos(e*r));
solx(r) = solve(eqn, x)
[r, fval] = fminsearch(matlabFunction(solx),1)