How to get one variable from one equation?

조회 수: 2 (최근 30일)
Rastek Hunter
Rastek Hunter 2012년 1월 15일
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.

답변 (2개)

Rijk
Rijk 2012년 1월 22일
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 2012년 1월 22일
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.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by