Wednesday, September 21, 2016

matlab code newton rapson method:

 newton rapson method:


Programme:

f=@(x) 30-15*(1/exp(.5*x))
f1=@(x) (7.5/exp(.5*x))
x1=0;
for i=0:1:10
x2=x1-(f(x1)/f1(x1));
if f(x2)==0
break;
else
x1=x2;
end
end
x2

MATLAB Running:

>> raph
f  = @(x)30-15*(1/exp(.5*x))
f1 = @(x)(7.5/exp(.5*x))
x2 = -1.3863
>> 

matlab code:false position method

false position method:


Simulation in MATLAB Programming environment:

clc
clear
f=@(x)x^2-4*x+1;
for i=1:10
    x1=input('x1=');
    x2=input('x2=');
    f1=f(x1);
    f2=f(x2);
    if f1*f2<0
        break;
    end
end
disp('        i          x1        f1      x2      f2        x3       f3')
for i=1:10
    f1=f(x1);
    f2=f(x2);
    x3=x1-(f(x1)*(x2-x1))/(f(x2)-f(x1));
    f3=f(x3);
   disp([i     x1       f1       x2      f2      x3       f3])
   if f1*f3<0
       x2=x3;
   else
       x1=x3;
   end
end
x3

MATLAB Running:

x1=0
x2=1
        i          x1        f1      x2      f2        x3       f3
    1.0000         0    1.0000    1.0000   -2.0000    0.3333   -0.2222
    2.0000         0    1.0000    0.3333   -0.2222    0.2727   -0.0165
    3.0000         0    1.0000    0.2727   -0.0165    0.2683   -0.0012
    4.0000         0    1.0000    0.2683   -0.0012    0.2680   -0.0001
    5.0000         0    1.0000    0.2680   -0.0001    0.2680   -0.0000
    6.0000         0    1.0000    0.2680   -0.0000    0.2679   -0.0000
    7.0000         0    1.0000    0.2679   -0.0000    0.2679   -0.0000
    8.0000         0    1.0000    0.2679   -0.0000    0.2679   -0.0000
    9.0000         0    1.0000    0.2679   -0.0000    0.2679   -0.0000
    10.0000         0    1.0000    0.2679   -0.0000    0.2679   -0.0000
x3 =
 0.2679 >>    

who is kajol agarwall.

she is the great actress in india.his smiling dancing stile of talking are interested to almost every man.who is she

do u know miss kajol

kajol aggarwal

Kajal Aggarwal (born 19 June 1985) is an Indian film actress and model. One of the most popular

Monday, September 19, 2016

matlab code for numerical analysis=bi-section method

islami bank scholarship

Simulation in MATLAB Programming environment:

clc
clear
f=@(x) 30-15*(1/exp(.5*x));
e=0.001;
for k=1:10
    x1=input('x1=');
  x2=input('x2=');
  f1=f(x1);
  f2=f(x2);
  if f1*f2<0
      break;
  end
end
disp('    i            x1         f1        x2        f2        x3       f3')
for i=1:20
     f1=f(x1);
  f2=f(x2);
    x3=(x1+x2)/2;
    f3=f(x3);
    disp([i     x1     f1     x2      f2     x3      f3])
    if f1*f3<0
        x2=x3;
    else
        x1=x3;
    end
end
root=x3

MATLAB Running:

x1=-1
x2=-2
    i            x1         f1        x2        f2        x3       f3
    1.0000   -1.0000    5.2692   -2.0000  -10.7742   -1.5000   -1.7550
    2.0000   -1.0000    5.2692   -1.5000   -1.7550   -1.2500    1.9763
    3.0000   -1.2500    1.9763   -1.5000   -1.7550   -1.3750    0.1689
    4.0000   -1.3750    0.1689   -1.5000   -1.7550   -1.4375   -0.7780
    5.0000   -1.3750    0.1689   -1.4375   -0.7780   -1.4063   -0.3008
    6.0000   -1.3750    0.1689   -1.4063   -0.3008   -1.3906   -0.0650
    7.0000   -1.3750    0.1689   -1.3906   -0.0650   -1.3828    0.0522
    8.0000   -1.3828    0.0522   -1.3906   -0.0650   -1.3867   -0.0064
    9.0000   -1.3828    0.0522   -1.3867   -0.0064   -1.3848    0.0229
   10.0000   -1.3848    0.0229   -1.3867   -0.0064   -1.3857    0.0083
   11.0000   -1.3857    0.0083   -1.3867   -0.0064   -1.3862    0.0010
   12.0000   -1.3862    0.0010   -1.3867   -0.0064   -1.3865   -0.0027
   13.0000   -1.3862    0.0010   -1.3865   -0.0027   -1.3864   -0.0009
   14.0000   -1.3862    0.0010   -1.3864   -0.0009   -1.3863    0.0000
   15.0000   -1.3863    0.0000   -1.3864   -0.0009   -1.3863   -0.0004
   16.0000   -1.3863    0.0000   -1.3863   -0.0004   -1.3863   -0.0002
   17.0000   -1.3863    0.0000   -1.3863   -0.0002   -1.3863   -0.0001
   18.0000   -1.3863    0.0000   -1.3863   -0.0001   -1.3863   -0.0000
   19.0000   -1.3863    0.0000   -1.3863   -0.0000   -1.3863    0.0000
   20.0000   -1.3863    0.0000   -1.3863   -0.0000   -1.3863   -0.0000
root =
 -1.3863