Help Solving an Equation

1 次查看(过去 30 天)
Hi,
I am trying to solve the following function for x where er, Re and d_i are known values:
x+4*log10(er/(3.7*d_i)+1.4125*x/Re)=0
I have tried several methods and cant seem to get the right answer. I know that the correct answer is approximately 10.8. Can anyone help me set this up?
Thanks in advance

采纳的回答

Star Strider
Star Strider 2016-10-27
编辑:Star Strider 2016-10-27
You have to provide the correct values for the constants.
This will provide you with the numeric result:
syms d_i er Re x
d_i = sym(3); % Insert Correct Values
er = sym(5); % Insert Correct Values
Re = sym(1000); % Insert Correct Values
Eq = x+4*log10(er/(3.7*d_i)+1.4125*x/Re) == 0;
x_sol = solve(Eq, x, 'IgnoreAnalyticConstraints',1);
x_val = double(x_sol) % Desired Numeric Result
EDIT You could do this numerically with fzero if you know the approximate value of the desired root:
d_i = 3; % Insert Correct Value
er = 5; % Insert Correct Value
Re = 1000; % Insert Correct Value
fcn = @(x) x+4*log10(er/(3.7*d_i)+1.4125*x/Re); % Anonymous Function
x_val = fzero(fcn, 10.8); % Solution
  2 个评论
Brittany Caughron
Brittany Caughron 2016-10-28
The second solution worked perfectly. Thank you so much!
Star Strider
Star Strider 2016-10-28
As always, my pleasure!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by