2
$\begingroup$

I have the following data which are the theoretical:

cycles={70954, 55331, 43274, 33942, 26701, 21065, 16667, 13225, 10524, 8398, 
6721, 5394, 4341, 3503, 2835, 2300, 1871, 1526, 1248, 1023, 841, 693, 
572, 473, 393, 326, 271, 226, 189, 158, 132, 110, 92, 77, 64, 53, 44, 
36, 29, 23, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2}

sigma={500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550, 555, 560, 
565, 570, 575, 580, 585, 590, 595, 600, 605, 610, 615, 620, 625, 630, 
635, 640, 645, 650, 655, 660, 665, 670, 675, 680, 685, 690, 695, 700, 
705, 710, 715, 720, 725, 730, 735, 740, 745, 750, 755, 760, 765, 770, 
775, 780, 785, 790, 795, 800, 805, 810, 815, 820, 825, 830, 835}

and here the experiment points.

ExpDatMPa={835.03, 823.4, 793.06, 704.82, 609.83, 602.62, 598.09, 595.61, 
591.55, 584.71, 551.18, 541.23, 539.32, 385.34, 385.21}

ExpDatN = {23, 69, 43, 328, 5941, 4506, 1876, 7898, 27015, 19154, 
  130885, 431405, 84036, 1003250, 113442}

I plot both of them using ListLogLinearPlot

ListLogLinearPlot[{Transpose[{cycles, sigma}], 
  Transpose[{ExpDatN, ExpDatMPa}]}, 
 AxesLabel -> {"Cycles [N]", "Stress Mpa"}, PlotRange -> Axis, 
 Joined -> {True, False},PlotLabel -> "S-N Cyclic Fatigue Life at R = -1 "]

enter image description here

Now I want to draw a logarithmic curve fit through the experimental points. I have searched through the help on Mathematica but could not find something which would help me understand how I could do it. Can somebody give me a hand?

$\endgroup$
2
$\begingroup$

One way to do this is to take the log of the data, and do a linear fit:

 fit = FindFit[ Transpose@{Log@ExpDatN, ExpDatMPa} , 
       a + b  ln , {a, b}, ln ]

or fit to the log expression:

 fit=FindFit[ Transpose@{ExpDatN, ExpDatMPa} , a + b  Log[n] , {a, b}, n ]

(same result)

 Show[{ListLogLinearPlot[{Transpose[{ExpDatN, ExpDatMPa}]}, 
      AxesLabel -> {"Cycles [N]", "Stress Mpa"}, PlotRange -> All, 
      PlotLabel -> "S-N Cyclic Fatigue Life at R = -1 "],
      LogLinearPlot[a + b Log[x] /. fit , {x, 1, 10^6}]}]

enter image description here

your plot is red because PlotRange->Axis is not a valid option, by the way.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.