Computational Methods in Engineering Essay Example

Computational Methods in Engineering

3(x+1)(x-0.5)(x-1) under the following interval =(x)The flowing equation has been solved using MATLAB program f

The scripts used to get roots for 3 iterations

>> n=-2; m=1.5;

>>[email protected](x)3*(x+1)*(x-0.5)*(x-1);

>>g=n-f(n);

>>h=m-f(m);

>>for i=1:3

d=(n+m)/2

fd=d-f(d)

if g*fd<0

m=d ; h=fd;

n=d; g=fd;

First iteration

d= -0.2500, fd = -2.3594

Second iteration

d = -1.1250, fd = 0.1699

Third iteration

d = -0.6875, fd = -2.5662

b). [-1.25, 2.5]

The scripts used to get roots for 3 iterations

>> n=-1.25; m=2.5;

>>[email protected](x)3*(x+1)*(x-0.5)*(x-1);

>>g=n-f(n);

>>h=m-f(m);

>>for i=1:3

d=(n+m)/2

fd=d-f(d)

if g*fd<0

m=d ; h=fd;

n=d; g=fd;

First iteration

d = 0.6250, fd = 0.8535

Second iteration

d = 1.5625, fd = -3.0320

Third iteration

d = 1.0938, fd = 0.7441