MATLAB: Find unknown from the equation with given value

retagurgent

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?

Best Answer

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 )