Fixed-point iteration Method for Solving non-linear equations in MATLAB(mfile)
% Fixed-point Algorithm
% Find the fixed point of y = cos(x).
g = @(x) cos(x);
p0 = input('Please enter initial approximation, p0: ');
n = input('Please enter no. of ierations, n: ');
tol = input('Please enter tolerance, tol: ');
i = 1;
while i <= n
p = g(p0);
if abs(p-p0) < tol
fprintf('\nApproximate solution p = %11.8f \n\n', p)
break;
else
i = i+1;
p0 = p;
end
end
>> Fixed_point_method_m
Please enter initial approximation, p0: 1
Please enter no. of ierations, n: 30
Please enter tolerance, tol: 0.001
Approximate solution p = 0.73876032
>>
I need to thank you for this very good read and i have bookmarked to check out new things from your post. Thank you very much for sharing such a useful article and will definitely saved and revisit your site.
ReplyDeleteData Science Course
Thanks for your marvelous posting! I really enjoyed reading it, you could be a great author. I will be sure to bookmark your blog and definitely will come back in the foreseeable future. I want to encourage you to continue your great posts, have a nice afternoon! Digital Marketing Course in Bangalore with Placement
ReplyDeleteNot too lengthy. Crisp and the meaning is conveyed. Nice blog.
ReplyDeleteMobile app development company in Hyderabad
An excellent topic that will be useful to others. I enjoyed reading.
ReplyDeleteSoftware development company in Hyderabad