mathematica code

5

Click here to load reader

Upload: saransh-sahu

Post on 08-Jul-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: mathematica code

8/19/2019 mathematica code

http://slidepdf.com/reader/full/mathematica-code 1/5

rate   = {15.73, 9.3, 1.77, 0.46, 6.54, 0.92, 0.15}

{15.73, 9.3, 1.77, 0.46, 6.54, 0.92, 0.15}

angle = {0, 5, 10, 15,  - 5,  - 10, - 15}

{0, 5, 10, 15,  -5,  -10,  -15}

time = {60, 180, 1200, 2700, 180, 1200, 2700}

{60, 180, 1200, 2700, 180, 1200, 2700}

error =rate

time

0.5

{0.512022, 0.227303, 0.0384057, 0.0130526, 0.190613, 0.0276887, 0.00745356}

 plotdata =  Table[{angle[[i]], rate[[i]]},  {i, 1, 7}]

{{0, 15.73},  {5, 9.3},  {10, 1.77},  {15, 0.46},  {-5, 6.54},  {-10, 0.92},  {-15, 0.15}}

FindFit plotdata, Γ2 π Γ2

4+ (x - x0)2

,  {x0, Γ}, x

FindFit::nrlnum : The function value

-15.73 +0.159155

0.25  + (0. + Times[2])2, -9.3 +

0.159155

0.25  + (5. + Times[2])2, -1.77 +

0.159155

0.25  + (10. + Times[2])2, -0.46 +

0.159155

0.25  + (15. + Times[2])2, -6.54 +

0.159155

0.25  + (-5. + Times[2])2, -0.92 +

0.159155

0.25 + (-10. + Times[2])2, -0.15 +

0.159155

0.25  + (-15. + Times[2])2 is not a list of real numbers with dimensions {7} at {x0, Γ} = {1., 1.}. 

FindFit{{0, 15.73},  {5, 9.3},  {10, 1.77},  {15, 0.46},

{-5, 6.54},  {-10, 0.92},  {-15, 0.15}},Γ

2 π Γ2

4  + (x - x0)

2,  {x

0

,

 Γ}, x

FindFit plotdata, a ⅇ-(- b+x)2

c2 ,  {a, b, c}, x

{a →  15.7868, b →  0.646209, c →  6.08616}

0.6462089416669212 * 4

2.58484

{a, b, c} /.   {a →  15.7868, b →  0.646209, c →  6.08616}

{15.7868, 0.646209, 6.08616}

5

20* 2.8

0.7

Page 2: mathematica code

8/19/2019 mathematica code

http://slidepdf.com/reader/full/mathematica-code 2/5

ShowListPlot[ plotdata, PlotStyle →  Red ],

Plota ⅇ-(- b+x)2

c2 /.   {a →  15.7868, b →  0.646209, c →   6.08616},  {x,  - 15, 15}

-15   -10   -5 5 10 15

5

10

15

Show[%10, ImageSize

 →  Full]

-15   -10   -5 5 10 15

5

10

15

2  

np 2.nb

Page 3: mathematica code

8/19/2019 mathematica code

http://slidepdf.com/reader/full/mathematica-code 3/5

Show[%8, ImageSize →   Full]

-15   -10   -5 5 10 15

5

10

15

ListPlot[ plotdata]

-15   -10   -5 5 10 15

5

10

15

np 2.nb 3

Page 4: mathematica code

8/19/2019 mathematica code

http://slidepdf.com/reader/full/mathematica-code 4/5

Show[%23, ImageSize →   Full]

-15   -10   -5 5 10 15

5

10

15

a * Exp-x - b

c

2

corr = {- 15.7,  - 10.7, 9.3, 14.3}

{-15.7,  -10.7, 9.3, 14.3}

Sin[ 45 Degree]

1

2

1

Sin corr

2Degree4

 plotdata = {{2873.7577240864957, 0.15},  {13 231.23914998318, 0.92},

{23 151.873995003032, 1.77},  {4166.558595462621, 0.46}}

{{2873.76, 0.15},  {13 231.2, 0.92},  {23 151.9, 1.77},  {4166.56, 0.46}}

FindFit[ plotdata, a x, a, x]

{a →   0.0000753356}

4  

np 2.nb

Page 5: mathematica code

8/19/2019 mathematica code

http://slidepdf.com/reader/full/mathematica-code 5/5

Show[ListPlot[ plotdata, PlotStyle →  Red ],

Plot[a x  /.   {a →   0.0000753356},  {x, 0, 24000}]]

5000 10 000 15 000 20 000

0.5

1.0

1.5

Show[%34, ImageSize →   Full]

5000 10 000 15 000 20 000

0.5

1.0

1.5

 plotdata *50

5000

{{28.7376, 0.0015},  {132.312, 0.0092},  {231.519, 0.0177},  {41.6656, 0.0046}}

0.53  7000

0.0000757143

np 2.nb 5