How to get one variable from one equation?

2 views (last 30 days)
Hi, I have an equation which is equal to a scalar value, (nDH /nair) I need to get the T from this equation but I could not succeed. I tried Maltlab built-in solve function and etc but no work
nDH /nair = -1.587 , and when I put it at right side of the equation
solve('0.02894 * (650 - T) + (0.4147 * 10.^-5 .*(650-T).^2) / 2 + (0.3191 * 10.^-8 *(650-T).^3)/3 -(1.965 *10.^-12 * (650-T).^4)/4 = -1.587')
Matlab gives this error
... is not a valid expression or equation.as fas as I understand, matlab "solve" function works with at least two equations, but in my case I have one.
I also tried [X] = solve(...) but no work.
Please I need som help.

Answers (2)

Rijk
Rijk on 22 Jan 2012
Apply:
syms T;
solve(0.02894 * (650 - T) + (0.4147 * 10.^-5 .*(650-T).^2) / 2 + (0.3191 * 10.^-8 *(650-T).^3)/3 -(1.965 *10.^-12 * (650-T).^4)/4 + 1.587)
So first declare T as a symbol.
The solve function solves expressions by equating them to 0. So therefore add 1.587 to the left hand side.

Walter Roberson
Walter Roberson on 22 Jan 2012
When you enclose an expression in quote marks and pass it to solve, then the expression has to be in MuPAD language, not in MATLAB. In particular, MuPAD does not understand the .^ or .* operators. It would also be safer to use 10^(-5) than 10^-5 as I am not sure that MuPAD understands ^- .
Rewrite of what you have:
solve('0.02894 * (650 - T) + (0.4147 * 10^(-5) * (650-T)^2) / 2 + (0.3191 * 10^(-8) *(650-T)^3)/3 - (1.965 *10^(-12) * (650-T)^4)/4 = -1.587')
Note: this has 4 solutions, two real and two imaginary.
By the way, solve() is happy with one equation.

Products

Community Treasure Hunt

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

Start Hunting!