
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

close all clear all clc syms x f=input('x e bağlı f fonksyonunu girin f:'); f1=diff(f,1); ft=inline(f1); x1=input('Aralığın 1. değerini girin x1:'); xu=input('Aralığın 2. değerini girin x2:'); acc=input('hata oranını girin:'); while ((ft(x1)ft(xu))>0) x1=input('Aralığın 1. değerini girin x1:'); xu=input('Aralığın 2. değerini girin x2:'); disp('Girdiğiniz aralıkta kök yoktur.') end while (abs(xu-x1)>acc) xm=(x1+xu)/2; if(ft(x1)ft(xm)<0) xu=xm; else x1=xm; end
deger=ft(xm); fprintf('*** orta nokta değeri:%f, *** fonksiyondaki değeri:%f \n',xm,deger);
end fprintf('orta yarılama metoduna göre denklemin kökü=%f\n',xm); fprintf('bulunan köke göre optimum değer %f',deger);