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

1 回表示 (過去 30 日間)
Samy Abisaleh
Samy Abisaleh 2020 年 3 月 26 日
コメント済み: Samy Abisaleh 2020 年 3 月 27 日
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 Center および File ExchangeLogical についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by