I need to create an anonymous function for the newton raphson method that finds the exact roots of (-1+5.5x-4x^2+0.5x^3) I do not even know where to begin.

4 ビュー (過去 30 日間)
I understand the derivative of my function must be present f' = 5.5-8x+1.5x^2 I also understand it follows a path of ; x_initial - f(x)/f'(x) there is a tolerance of 1e-4 beyond this, I do not know where to build this from scratch. I would appreciate if I could gain some knowledge from anyone willing to extend theirs. thanks in advance.

回答 (1 件)

misha riaz
misha riaz 2020 年 8 月 8 日
clear all
clc
syms x;
fun=input('Enter the funtion as a variable of X');
f=inline(fun);
z=diff(f(x));
f1=inline(z);
x0=input('Enter the initial value of interval');
x=x0;
for i=0:inf
y=x;
x=y-(f(x)/f1(x));
if x==y
break
end
end
fprintf('The total number of iteration are:');
i
x

カテゴリ

Help Center および File ExchangeNewton-Raphson Method についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by