Use MATLAB software to solve the following Include all codes

Use MATLAB software to solve the following (Include all codes and plots if necessary):

Find the solution of f(x) = x^3 - 10 using the SECANT method

Solution

clear
clc

%// Initial values and tolerance
x(1) = 2;
x(2) = 4;
f = @(x) x^3-10;

tolerance = 0.001;

%// Let\'s try from 3 to 15.
for k=3:15

x(k) = x(k-1) - (f(x(k-1)))*((x(k-1) - x(k-2))/(f(x(k-1)) - f(x(k-2))));

if abs(x(k)-x(k-1)) < tolerance
break
end
end

For negative roots take -2&-4

Use MATLAB software to solve the following (Include all codes and plots if necessary): Find the solution of f(x) = x^3 - 10 using the SECANT methodSolutionclear

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site