Newton Method // Matlab Code

Posted: March 10, 2012 by muhammadakif in Algorithms
Tags: , , , , ,
x0 = 5;
x1 = x0;

fx0 = (3*x0+sin(x0)-exp(x0))
fx1 = (3+cos(x0)-exp(x0))

if(fx0 ~= 0 && fx1 ~= 0)
while(abs(x1 - x0) < 0.0000001 || abs(fx1) < 0.000001)
x1 = x0
x0 = x0 - (fx0/fx1)
end
end
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s