Newton's Method to Solve Equation
조회 수: 1 (최근 30일)
이전 댓글 표시
I trying to write a code to solve an equation using newton's method and given three inputs.
So far I have
syms L h T g
f_L = L-g*T*T/(2*pi)*tanh(2*pi*h/L)
Df = diff(f_L,L)
The variable Df is in symbolic form but I need to convert it to numeric. Any ideas how to do this?
Thank you
댓글 수: 0
답변 (1개)
Yongjian Feng
2021년 9월 12일
You need to substitute symbols with values, right?
L = 1.0;
h = 2.0;
T = 3.0;
g = 9.8;
% substitute
ret = subs(Df);
% convert
res = double(ret);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!