Skip to main content
2 of 2
added 1 character in body
Nikolas
  • 105
  • 9

Plot least squares curve on Linear Log Plot

I have the following Data:

ExpDataCycles = {23, 69, 39, 25, 6, 43, 431, 328, 130, 614, 5941, 
   4506, 1876, 7898, 27015, 19154, 11586, 21470,
   130885, 431405, 84036, 1003250};
ExpDataMpa = {835.0265363, 823.4175447, 810.7696175, 799.6485919, 
   794.4425228, 793.0602069, 707.6873459,
   704.8236368, 693.9200675, 687.0103167, 609.8345095,
   602.6188024, 598.086902, 595.6103517, 591.5466695,
   584.7172701, 559.4813142, 556.6416481, 551.1841848,
   541.232457, 539.3158579, 385.3438704};

Which I plot using ListLogLinearPlot

ListLogLinearPlot[Transpose[{ExpDataCycles, ExpDataMpa}], 
 PlotRange -> Automatic, AxesLabel -> {"Cycles [N]", "Stress Mpa"}, 
 PlotLabel -> "S-N Cyclic Loading Life at R = -1 "]

enter image description here

I'm trying to plot a best fit curve using least squares.

I plot using:

ExpDataCyclesMpa = Transpose[{ExpDataCycles, ExpDataMpa}];
LeastSqr = Fit[ExpDataCyclesMpa, {1, x, x^2}, x];
Show[ListLogLinearPlot[Transpose[{ExpDataCycles, ExpDataMpa}]], 
 Plot[LeastSqr, {x, 0, 1100000}]]

enter image description here

I understand the issue of the straight lines which i thick is because my x-axis is in Log form. How can I Plot a quadratic least squares fit between the LinearLog graph?

Nikolas
  • 105
  • 9