Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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!

Respuesta aceptada

Birdman
Birdman el 27 de Mzo. de 2020
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)
  1 comentario
Samy Abisaleh
Samy Abisaleh el 27 de Mzo. de 2020
This works out perfectly. I believe the mistake I made was in the fminsearch, I needed the final value to be one term and I had it as two. If you look above, you can see at the end I had it as [1 1] and I needed it to be [1].

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by