Wednesday, November 28, 2012

MATLAB - Iteration Method

iteration_method
% =====================================================================
% ******** To find root of given equation by iteration method *********
% ************************ By Mahesha MG ******************************
% Date: 28/11/2012
% =====================================================================

clc;
clear;
display('Equation: x=sin(x)')
x=input('Enter initial value for x: ');
e=input('Enter accuracy: ');
while(abs(x-sin(x))>e)
    x=sin(x);
end
x

No comments:

Post a Comment