Filter löschen
Filter löschen

Code not is solving for the missing Variable but not inputing the inputs

2 Ansichten (letzte 30 Tage)
Arturo
Arturo am 29 Nov. 2022
Kommentiert: Rohit am 22 Feb. 2023
%1a create equation and solve for T
syms ko k Q R T
eqn = k ==ko*exp((-Q/(R*T)))
T_sol = solve(eqn,T)
%1b input values 1,2,3,4
ko = input('enter k_o value:\n');
k = input('enter k value:\n');
Q = input('enter Q value:\n');
R = input('enter R value:\n');
eqn = k ==ko*exp((-Q/(R*T)))
T_F = T_sol
%2 display solution T_F should equal -1.082
table(ko,k,Q,R,T_F)

Antworten (1)

Rohit
Rohit am 21 Feb. 2023
You need to call solve function again after taking the inputs to get the desired output.
>> T_F = double(solve(eqn,T))
T_F =
-1.082021280666723
>> table(ko,k,Q,R,T_F)
ans =
1×5 table
ko k Q R T_F
__ _ _ _ _________________
1 2 3 4 -1.08202128066672
  2 Kommentare
Walter Roberson
Walter Roberson am 21 Feb. 2023
no, you would subs() the numeric values into the previous solve() answer.
Rohit
Rohit am 22 Feb. 2023
Yes, we can also do it using the subs(eqn) after getting the inputs.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by