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

조회 수: 1 (최근 30일)
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!

채택된 답변

Birdman
Birdman 2020년 3월 27일
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
Samy Abisaleh
Samy Abisaleh 2020년 3월 27일
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].

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by