2 views (last 30 days)

% EMTH171

% script using newtons method

clear

clc

close all

% function

f = @(x) 3*x.^4 + 7*x.^3 - 4*x.^2 - 10*x + 1/5;

% derivative

d = @(x) 12*x.^3 + 21*x.^2 - 8*x - 10;

% test value

x = -0.5;

N = 100;

for ii =1 : N

x = x - f(x)/d(x);

end

z = nArray(4,1);

disp(z);

Rafael Hernandez-Walls
on 30 Aug 2020

clear

clc

close all

% function

f = @(x) 3*x.^4 + 7*x.^3 - 4*x.^2 - 10*x + 1/5;

% derivative

df = @(x) 12*x.^3 + 21*x.^2 - 8*x - 10;

%first graphic

x=-2.4:.001:1.3;

plot(x,f(x));

grid on;

% test value; click with mouse near x=1

[x y]=ginput(1);

%iterations newton method

N = 100;

for ii =1 : N

x = x - f(x)/df(x);

end

disp('Solution:')

x

Opportunities for recent engineering grads.

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

Start Hunting!
## 3 Comments

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/586313-hi-i-am-trying-to-calculate-the-4th-root-of-the-function-f-x-3x4-7x3-4x2-10x-15-using-newtons-metho#comment_990365

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/586313-hi-i-am-trying-to-calculate-the-4th-root-of-the-function-f-x-3x4-7x3-4x2-10x-15-using-newtons-metho#comment_990365

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/586313-hi-i-am-trying-to-calculate-the-4th-root-of-the-function-f-x-3x4-7x3-4x2-10x-15-using-newtons-metho#comment_990368

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/586313-hi-i-am-trying-to-calculate-the-4th-root-of-the-function-f-x-3x4-7x3-4x2-10x-15-using-newtons-metho#comment_990368

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/586313-hi-i-am-trying-to-calculate-the-4th-root-of-the-function-f-x-3x4-7x3-4x2-10x-15-using-newtons-metho#comment_990374

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/586313-hi-i-am-trying-to-calculate-the-4th-root-of-the-function-f-x-3x4-7x3-4x2-10x-15-using-newtons-metho#comment_990374

Sign in to comment.