Skip to content

Commit

Permalink
Date - 17 september,2020
Browse files Browse the repository at this point in the history
  • Loading branch information
masum035 authored Apr 25, 2021
1 parent 123ad14 commit eaf66a6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Regula Falsi Method/solution_of_problem-2.m
Original file line number Diff line number Diff line change
@@ -0,0 1,33 @@
es = 0.5*10^(2-6);
x0 = input ('X0= ');

f = @(x)x^6-x^4-x^3-1
f1 = @(x)6*x^5-4*x^3-3*x^2

for i=1:6
c(i)=x0-f(x0)/f1(x0);
x0=c(i);
if(i>1)
e(i-1)=(abs(c(i)-c(i-1)))/c(i)*100;
if(e(i-1)<es)
break;
end
end
end

disp('Roots')
fprintf('\nX0 =')
fprintf('%.6f ',c);
fprintf('\n\n')
disp('Error')
fprintf('\ne = ')
fprintf('%.6f ',e);
fprintf('\n')
root = roots(p);
fprintf('\n\n')
disp('Using roots function: ')
display(root)
disp('Using fzero function: ')
z = fzero(f,x0)
disp('Using fsolve function: ')
s = fsolve(f,x0)

0 comments on commit eaf66a6

Please sign in to comment.