Solving an equation with multiple variables in MATLAB
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I'm trying to solve an equation using MATLAB that has multiple variables.
I have the variables

The equation I am trying to solve is
where
is the variable I am trying to solve for.
is the variable I am trying to solve for.in MATLAB I tried to use syms in order to solve this:
syms Ti Tsurr Ts k E x L
eqn = -k(Ts - Ti)/L -h(Ts - Tsurr) - E*x*(Ts^4 - Tsurr^4) == 0
ans = solve (eqn, Ts)
But I get an error message like this:
Error using sym/subsindex (line 864)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be
symbolic variables, and function body must be sym expression.
Error in sym/subsref (line 909)
R_tilde = builtin('subsref',L_tilde,Idx);
How do I go about solving this equation in MATLAB? Is it correct to use the syms function for this?
Is it better to simply define each variable's numerical value (except
)and then use syms with only
as the variable?
)and then use syms with only
as the variable?0 commentaires
Réponses (1)
Walter Roberson
le 15 Sep 2021
syms E h k L Ti Tsurr Ts x
eqn = -k*(Ts - Ti)/L - h*(Ts - Tsurr) - E*x*(Ts^4 - Tsurr^4) == 0
sol_implicit = solve (eqn, Ts)
sol_explicit = simplify(solve(eqn, Ts, 'MaxDegree', 4))
0 commentaires
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


