필터 지우기
필터 지우기

How to solve an equation with one unknown?

조회 수: 35 (최근 30일)
Ahmad Ghareeb
Ahmad Ghareeb 2017년 2월 28일
답변: Walter Roberson 2017년 2월 28일
For example:
ss = (16*T*do)/pi*(do^4-di^4)
all variables are know except for (di). What is the code to solve it? Thanks in advance!
  댓글 수: 3
Roger Stafford
Roger Stafford 2017년 2월 28일
I like your reply, John. Pencil and paper is certainly the right way to do that problem.
Ahmad Ghareeb
Ahmad Ghareeb 2017년 2월 28일
This is just an example.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 2월 28일
syms di
syms ss T do %or assign numeric values to the variables
Pi = sym('pi');
eqn = ss == (16*T*do)/Pi*(do^4-di^4);
sol = solve(eqn, di)
The result you get back will be a vector of four elements, reflecting the four roots of the quartic. You can use double(sol) to see the decimal versions of the exact solutions.
Depending on what you are solving, you might encounter cases where you see outputs such as
root(16*2^(1/2)*z^5 - 16*2^(1/2)*di^4*z - 17*pi, z, 1)
root(16*2^(1/2)*z^5 - 16*2^(1/2)*di^4*z - 17*pi, z, 2)
The form root(f(z), z, N) selects from the set of values, z, such that f(z) = 0 -- that is, the roots of the equation. You will sometimes even see this for cubic equations and it is not uncommon for quartic equations; most quintics and above will generate root() forms.

카테고리

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