How do I specify which variable I want Matlab to solve an equation for so that I don't have to do the algebra myself?

6 ビュー (過去 30 日間)
I am trying to find a way to get Matlab to do the algebra for me so that I don't have to rearrange equations for the variables I want every time I use them. I have tried using solve and fsolve, but I was probably doing it wrong so it didn't get me anywhere.
I am just trying to solve for Ubar in the equation below. Is there a way to put this equation in and specify which variable I want Matlab to solve for?
c = 6;
k = 1.8;
c = Ubar*(0.568+0.433/k)^(-1/k)

採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 14 日
syms Ubar
c = 6;
k = 1.8;
eqn = c == Ubar*(0.568+0.433/k)^(-1/k)
solve(eqn, Ubar)
However, the answer should be obvious. Ubar is simply multiplied by a constant and the result is equal to a constant, so obviously the solution is
Ubar == c / (0.568+0.433/k)^(-1/k)
  1 件のコメント
Michael Boyle
Michael Boyle 2021 年 2 月 14 日
Thank you! I know it's a simple solution, but I wanted to know how to set it up for more complicated equations going forward.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by