hw04_1_13b
raw download clone
MATLAB
views 19
,
size 315 b
clear;
clc;
format long;
f = @(x) (230 * x^4) + (18 * x^3) + (9 * x^2) - (221 * x) - 9;
x0 = -1;
x1 = 0;
%x0 = 0;
%x1 = 1;
y0 = f(x0);
y1 = f(x1);
Err = 1;
while Err > 10^(-6)
  x = x1 - ((y1 * (x1 - x0)) / (y1 - y0));
  Err = abs(x - x1);
  x0 = x1;
  y0 = y1;
  x1 = x;
  y1 = f(x1);
endwhile
x
close fullscreen
Login or Register to edit or fork this paste. It's free.