Find unknown from the equation with given value

24 Ansichten (letzte 30 Tage)
Sheryl
Sheryl am 9 Mär. 2013
Beantwortet: prasad p am 28 Jun. 2021
I need to calculate the unknown in the equation, how could i do so using matlab?
this is the equation: c=(1/(tm=60))*(tm*exp(-t/tm)-60*exp(-t/60))
value c and t will be provided
how could find the value tm using matlab?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Mär. 2013
Using similar ideas to the above:
[...] %define your values for c and t first
syms tm
double( solve( c - ( (1/(tm-60))*(tm*exp(-t/tm)-60*exp(-t/60)) ), tm ) )
or if you have a bunch of these to solve,
syms c t tm
tmfun = matlabFunction( solve( c - ( (1/(tm-60))*(tm*exp(-t/tm)-60*exp(-t/60)) ), tm ), 'vars', {c, t} );
then after that,
tmfun( current_c, current_t )

Weitere Antworten (2)

Sven
Sven am 10 Mär. 2013
Hi Sheryl, If you have the Symbolic Maths toolbox, you can do something like:
Step 1: Set up your equation. Note that you had "tm=60" inside some parentheses. This seems like a typo... I changed it to "tm-60" instead.
myEqn = sym('c = (1/(tm-60))*(tm*exp(-t/tm)-60*exp(-t/60))')
Step 2: Tell MATLAB two of your variables (say, t=5 and c=45):
newEqn = subs(myEqn,{'t','c'}, [5,45])
Step 3: Ask MATLAB to solve for the remaining term (which is tm):
solve(newEqn)
ans =
-0.59449842358712896610400951227259
Is that what you were trying to do?
  2 Kommentare
Paige
Paige am 10 Mär. 2013
Bearbeitet: Paige am 10 Mär. 2013
Hi, I have tried this and it keeps coming up with the error 'Warning:Explicit solution could not be found', or
1/(lambertw(0, -(703687441776640*exp(-10555311626649600/124074044717989621))/372222134153968863)/5 + 2111062325329920/124074044717989621)
And I have tried to work out what lambertw means with no luck. Why is this?
Thanks in advance

Melden Sie sich an, um zu kommentieren.


prasad p
prasad p am 28 Jun. 2021
I want to solve above equation in matlab. I want to slove for unknown value of t4 and t2. But I need the solution t2 and t4 for a range of Please help me to write a code for this in matlab software.

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