Error implementing Newton's Method

조회 수: 1 (최근 30일)
Viraj
Viraj 2024년 8월 26일
답변: Walter Roberson 2024년 8월 26일
Tried implementing Newton's Method in MATLAB, but receiving this error regarding indexing. Not sure what this means or how to fix it.

답변 (1개)

Walter Roberson
Walter Roberson 2024년 8월 26일
syms x
f = @(x) x^3 - 2*x^2 - 5;
df = diff(f,x)
df = 
class(df)
ans = 'sym'
Notice that the class of df is sym. df is a symbolic scalar. Attempting to invoke df(po) is an attempt to index the symbolic scalar df at the location indicated by po
What you need is
df = matlabFunction( diff(f, x) )

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by