フィルターのクリア

solve equation for a variable

4 ビュー (過去 30 日間)
SETH SCHREINER
SETH SCHREINER 2023 年 2 月 28 日
コメント済み: Anton Kogios 2023 年 2 月 28 日
I'm sure this sort of thing has been posted numerous times, but I can't find anything that works for me for whatever reason. I need to solve an equation for a variable, and I can't remember how to do this. It's been a while since I've used matlab. I need to solve for t numerically. This is the last thing I tried:
v = 2.42;
si_f235 = 577E-24;
N_235 = 780.63E18;
phi = 3E13;
si_a235 = 101E-24;
si_a238 = 2.73E-24;
N_238 = 21.52E21;
n = 1.5;
eqn = @(x) v*si_f235*N_235(1-si_f235*phi*x)/(si_a235*N_235*(1-si_a235*phi*x)+si_a238*N_238*(1-si_a238*phi*x))==n;
t = vpasolve(eqn , x)
it's just telling me that x is an unrecognized variable

採用された回答

Anton Kogios
Anton Kogios 2023 年 2 月 28 日
This works for me (you were also missing an * in your equation):
v = 2.42;
si_f235 = 577E-24;
N_235 = 780.63E18;
phi = 3E13;
si_a235 = 101E-24;
si_a238 = 2.73E-24;
N_238 = 21.52E21;
n = 1.5;
syms x
eqn = v*si_f235*N_235*(1-si_f235*phi*x)/(si_a235*N_235*(1-si_a235*phi*x)+si_a238*N_238*(1-si_a238*phi*x))==n;
t = vpasolve(eqn , x)
t = 
47756908.067411697270732667471209
  3 件のコメント
SETH SCHREINER
SETH SCHREINER 2023 年 2 月 28 日
oh i dont have the right toolbox apparently
Anton Kogios
Anton Kogios 2023 年 2 月 28 日
Yes sorry, this requires the Symbolic Math Toolbox, which is very helpful for these sorts of problems. You could of course always follow Torsten's advice in his answer.

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

その他の回答 (1 件)

Torsten
Torsten 2023 年 2 月 28 日
編集済み: Torsten 2023 年 2 月 28 日
You don't need a toolbox for this.
Take a piece of paper and a pencil, multiply the equation by the denominator of the left-hand side, collect terms with x on one side and other terms on the other side, factor out x on the one side and solve for x.
It's just like solving 3*x + 5 = 7*x - 4 for x.
  1 件のコメント
SETH SCHREINER
SETH SCHREINER 2023 年 2 月 28 日
I get how to do it on pencil and paper, but the equation gets rather tedious trying to separate out x from the other variables towards the end

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

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by