Effacer les filtres
Effacer les filtres

Find unknown from the equation with given value

7 vues (au cours des 30 derniers jours)
Sheryl
Sheryl le 9 Mar 2013
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?

Réponse acceptée

Walter Roberson
Walter Roberson le 10 Mar 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 )

Plus de réponses (2)

Sven
Sven le 10 Mar 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 commentaires
Paige
Paige le 10 Mar 2013
Modifié(e) : Paige le 10 Mar 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

Connectez-vous pour commenter.


prasad p
prasad p le 28 Juin 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.

Catégories

En savoir plus sur Programming 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!

Translated by