Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Bisection method root finding in matlab, Study Guides, Projects, Research of Matlab skills

Function root was found by bisection method in matlab. this program shows whole midpoint roots...

Typology: Study Guides, Projects, Research

2018/2019

Uploaded on 03/22/2019

sevil
sevil 🇹🇷

3

(1)

2 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
BISECTION METHOD İN MATLAB
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);

Partial preview of the text

Download Bisection method root finding in matlab and more Study Guides, Projects, Research Matlab skills in PDF only on Docsity!

BISECTION METHOD İN MATLAB

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);