HDQ Basith Studio

Specialized for graphic design and 3D modelling.

Download anything

Here you can get many useful software, music, and many kind of file.

Get windows problem?

Don't worry, here you may get the solutions of your windows problems.

Tips and Tricks

Sometimes a problem can be solved with a simple solution. Find the easiest and strangest solutions here.

Wanna get a high degree?

يرفع الله الذين آمنوا منكم والذين أوتوا العلم درجات

Kamis, 08 Maret 2012

Contoh metode Newton dengan Matlab

Berikut adalah contoh kode untuk mencari akar-akar persamaan kuadrat dengan metode Newton


'Metode Newton'
x=input('masukkan tebakan awal : ');
y=-1+5.5*x-4*x^2+0.5*x^3;
dy=5.5-8*x+1.5*x^2;
x1=x-y/dy;
if y~=0;
    e=abs((x1-x)/x);
    while e>0.0001;
        x=x1;
        y=-1+5.5*x-4*x^2+0.5*x^3;
        dy=5.5-8*x+1.5*x^2;
        x1=x-y/dy;
        e=abs((x1-x)/x);
    end;
    e=e*100;
    fprintf('%15.13f\n',x1)
    fprintf('%15.13f',e)   
else
    x
end

a=-1:0.2:7;
b=-1+5.5*a-4*a.^2+0.5*a.^3;
plotyy (a,b,a,b,'plot','stem');