How to solve implicit function without using solve() function?

I searched online how to solve a implicit function in Matlab and here is the link it sent me to, https://www.mathworks.com/matlabcentral/answers/247461-best-way-to-solve-for-a-implicit-equation. I attempted to use the example in the link, but I get an error.
Exiting fzero: aborting search for an interval containing a sign change
because complex function value encountered during search.
(Function value at -0.28 is 15.0459-1.88983i.)
Check function or try again with a different starting value.
I was thinking about using the solve() function in Matlab, however I would need to purchase the symbolic math toolbox. :/ If there isn't a solution for this I may just re-write the equation in explicit form.
Attached is an image of the equation. I want to solve for 'f'.
func = (1 / sqrt(f5)) - 2 * log((eps / D) / 3.7) + ((2.51) / (Re * sqrt(f5)));
f5 = solve(func, 1)

 채택된 답변

Star Strider
Star Strider 2019년 1월 27일
If you have the Optimization Toolbox, use the fsolve function:
D = something;
Re = something_else;
func = @(f5) (1 / sqrt(f5)) - 2 * log((eps / D) / 3.7) + ((2.51) / (Re * sqrt(f5)));
f5 = fsolve(func, 1)

댓글 수: 2

I don't have the Optimization Toolbox. Thanks for answering my question and letting me know which toolbox I need to get.
My pleasure.
That, and the Global Optimization Toolbox are both worth getting, for their robust optimization routines.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

태그

질문:

2019년 1월 27일

댓글:

2019년 1월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by