Unable to understand how FindFit function works.

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












ks = 0.01, 1, 2, 4, 6, 8, 10, 25, 50, 100, 200, 300, 400, 500, 600, 
800, 1*^3, 2*^3, 4*^3, 5*^3, 10*^3, 15*^3, 20*^3, 30*^3, 40*^3,
70*^3, 1*^5, 1*^6, 1*^8, 1*^12;
aa1 = 3.14172, 3.15756, 3.17331, 3.2041, 3.23399, 3.26304, 3.29131,
3.48223, 3.74135, 4.13211, 4.66617, 5.04019, 5.3278, 5.56008,
5.75347, 6.05965, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
6.28314, 6.28314;
aa2 = 9.42478, 9.42537, 9.42596, 9.42716, 9.42836, 9.42955, 9.43075,
9.43974, 9.45479, 9.48511, 9.54657, 9.60893, 9.67202, 9.73563,
9.79957, 9.92774, 10.0553, 10.6536, 11.5696, 11.9059, 12.5663,
12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
12.5663, 12.5663;
aa3 = 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.9037,
13.3636, 13.6161, 13.8784, 14.0112, 14.1813, 14.2487, 14.388,
14.4031, 14.4032;
p1 = ListLogLinearPlot[Table[ks[[i]], aa1[[i]], i, Length[ks]],
Joined -> True, PlotRange -> All];
p2 = ListLogLinearPlot[Table[ks[[i]], aa2[[i]], i, Length[ks]],
Joined -> True, PlotRange -> All];
p3 = ListLogLinearPlot[Table[ks[[i]], aa3[[i]], i, Length[ks]],
Joined -> True, PlotRange -> All];
Show[p1, p2, p3, PlotRange -> All]
lst = N[Table[Log10[ks[[i]]], aa1, i, Length[ks]]]
model = a E^(b (x - c))/(E^(b (x - c)) + 1) + d
ff = FindFit[lst, model, a, b, c, d, x]
Plot[model /. ff, x, 0, 12, PlotRange -> 0, 12, 3, 6.5,
GridLines -> Automatic]


I have three sets of data aa1,aa2,aa3, I am trying to fit an equation for this data, data looks like a sigmoid function. So I have used a fit model which resembles the sigmoid function. Later I used the FindFit function to extract the unknown coefficients. when I plotted the fitted model I am getting a straight line. What mistake I am doing. same thing is happening for aa2 and aa3.










share|improve this question

























    up vote
    1
    down vote

    favorite
    1












    ks = 0.01, 1, 2, 4, 6, 8, 10, 25, 50, 100, 200, 300, 400, 500, 600, 
    800, 1*^3, 2*^3, 4*^3, 5*^3, 10*^3, 15*^3, 20*^3, 30*^3, 40*^3,
    70*^3, 1*^5, 1*^6, 1*^8, 1*^12;
    aa1 = 3.14172, 3.15756, 3.17331, 3.2041, 3.23399, 3.26304, 3.29131,
    3.48223, 3.74135, 4.13211, 4.66617, 5.04019, 5.3278, 5.56008,
    5.75347, 6.05965, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
    6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
    6.28314, 6.28314;
    aa2 = 9.42478, 9.42537, 9.42596, 9.42716, 9.42836, 9.42955, 9.43075,
    9.43974, 9.45479, 9.48511, 9.54657, 9.60893, 9.67202, 9.73563,
    9.79957, 9.92774, 10.0553, 10.6536, 11.5696, 11.9059, 12.5663,
    12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
    12.5663, 12.5663;
    aa3 = 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
    12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
    12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.9037,
    13.3636, 13.6161, 13.8784, 14.0112, 14.1813, 14.2487, 14.388,
    14.4031, 14.4032;
    p1 = ListLogLinearPlot[Table[ks[[i]], aa1[[i]], i, Length[ks]],
    Joined -> True, PlotRange -> All];
    p2 = ListLogLinearPlot[Table[ks[[i]], aa2[[i]], i, Length[ks]],
    Joined -> True, PlotRange -> All];
    p3 = ListLogLinearPlot[Table[ks[[i]], aa3[[i]], i, Length[ks]],
    Joined -> True, PlotRange -> All];
    Show[p1, p2, p3, PlotRange -> All]
    lst = N[Table[Log10[ks[[i]]], aa1, i, Length[ks]]]
    model = a E^(b (x - c))/(E^(b (x - c)) + 1) + d
    ff = FindFit[lst, model, a, b, c, d, x]
    Plot[model /. ff, x, 0, 12, PlotRange -> 0, 12, 3, 6.5,
    GridLines -> Automatic]


    I have three sets of data aa1,aa2,aa3, I am trying to fit an equation for this data, data looks like a sigmoid function. So I have used a fit model which resembles the sigmoid function. Later I used the FindFit function to extract the unknown coefficients. when I plotted the fitted model I am getting a straight line. What mistake I am doing. same thing is happening for aa2 and aa3.










    share|improve this question























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      ks = 0.01, 1, 2, 4, 6, 8, 10, 25, 50, 100, 200, 300, 400, 500, 600, 
      800, 1*^3, 2*^3, 4*^3, 5*^3, 10*^3, 15*^3, 20*^3, 30*^3, 40*^3,
      70*^3, 1*^5, 1*^6, 1*^8, 1*^12;
      aa1 = 3.14172, 3.15756, 3.17331, 3.2041, 3.23399, 3.26304, 3.29131,
      3.48223, 3.74135, 4.13211, 4.66617, 5.04019, 5.3278, 5.56008,
      5.75347, 6.05965, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
      6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
      6.28314, 6.28314;
      aa2 = 9.42478, 9.42537, 9.42596, 9.42716, 9.42836, 9.42955, 9.43075,
      9.43974, 9.45479, 9.48511, 9.54657, 9.60893, 9.67202, 9.73563,
      9.79957, 9.92774, 10.0553, 10.6536, 11.5696, 11.9059, 12.5663,
      12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
      12.5663, 12.5663;
      aa3 = 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
      12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
      12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.9037,
      13.3636, 13.6161, 13.8784, 14.0112, 14.1813, 14.2487, 14.388,
      14.4031, 14.4032;
      p1 = ListLogLinearPlot[Table[ks[[i]], aa1[[i]], i, Length[ks]],
      Joined -> True, PlotRange -> All];
      p2 = ListLogLinearPlot[Table[ks[[i]], aa2[[i]], i, Length[ks]],
      Joined -> True, PlotRange -> All];
      p3 = ListLogLinearPlot[Table[ks[[i]], aa3[[i]], i, Length[ks]],
      Joined -> True, PlotRange -> All];
      Show[p1, p2, p3, PlotRange -> All]
      lst = N[Table[Log10[ks[[i]]], aa1, i, Length[ks]]]
      model = a E^(b (x - c))/(E^(b (x - c)) + 1) + d
      ff = FindFit[lst, model, a, b, c, d, x]
      Plot[model /. ff, x, 0, 12, PlotRange -> 0, 12, 3, 6.5,
      GridLines -> Automatic]


      I have three sets of data aa1,aa2,aa3, I am trying to fit an equation for this data, data looks like a sigmoid function. So I have used a fit model which resembles the sigmoid function. Later I used the FindFit function to extract the unknown coefficients. when I plotted the fitted model I am getting a straight line. What mistake I am doing. same thing is happening for aa2 and aa3.










      share|improve this question













      ks = 0.01, 1, 2, 4, 6, 8, 10, 25, 50, 100, 200, 300, 400, 500, 600, 
      800, 1*^3, 2*^3, 4*^3, 5*^3, 10*^3, 15*^3, 20*^3, 30*^3, 40*^3,
      70*^3, 1*^5, 1*^6, 1*^8, 1*^12;
      aa1 = 3.14172, 3.15756, 3.17331, 3.2041, 3.23399, 3.26304, 3.29131,
      3.48223, 3.74135, 4.13211, 4.66617, 5.04019, 5.3278, 5.56008,
      5.75347, 6.05965, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
      6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314, 6.28314,
      6.28314, 6.28314;
      aa2 = 9.42478, 9.42537, 9.42596, 9.42716, 9.42836, 9.42955, 9.43075,
      9.43974, 9.45479, 9.48511, 9.54657, 9.60893, 9.67202, 9.73563,
      9.79957, 9.92774, 10.0553, 10.6536, 11.5696, 11.9059, 12.5663,
      12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
      12.5663, 12.5663;
      aa3 = 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
      12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663,
      12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.5663, 12.9037,
      13.3636, 13.6161, 13.8784, 14.0112, 14.1813, 14.2487, 14.388,
      14.4031, 14.4032;
      p1 = ListLogLinearPlot[Table[ks[[i]], aa1[[i]], i, Length[ks]],
      Joined -> True, PlotRange -> All];
      p2 = ListLogLinearPlot[Table[ks[[i]], aa2[[i]], i, Length[ks]],
      Joined -> True, PlotRange -> All];
      p3 = ListLogLinearPlot[Table[ks[[i]], aa3[[i]], i, Length[ks]],
      Joined -> True, PlotRange -> All];
      Show[p1, p2, p3, PlotRange -> All]
      lst = N[Table[Log10[ks[[i]]], aa1, i, Length[ks]]]
      model = a E^(b (x - c))/(E^(b (x - c)) + 1) + d
      ff = FindFit[lst, model, a, b, c, d, x]
      Plot[model /. ff, x, 0, 12, PlotRange -> 0, 12, 3, 6.5,
      GridLines -> Automatic]


      I have three sets of data aa1,aa2,aa3, I am trying to fit an equation for this data, data looks like a sigmoid function. So I have used a fit model which resembles the sigmoid function. Later I used the FindFit function to extract the unknown coefficients. when I plotted the fitted model I am getting a straight line. What mistake I am doing. same thing is happening for aa2 and aa3.







      fitting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 7 hours ago









      vijay

      1357




      1357




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          In your definition of lst, I believe you forgot to add the Part specification on aa1.



          lst = N[Table[Log10[ks[[i]]], aa1[[i]], i, Length[ks]]]


          or



          lst = Thread@Log10[ks], aa1 // N


          Which then yields the final plot



          enter image description here






          share|improve this answer






















          • Extremely sorry, It's my mistake, I did not give attention to missing aa1[[i]]. Thanks for your time.
            – vijay
            6 hours ago










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "387"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184263%2funable-to-understand-how-findfit-function-works%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          4
          down vote



          accepted










          In your definition of lst, I believe you forgot to add the Part specification on aa1.



          lst = N[Table[Log10[ks[[i]]], aa1[[i]], i, Length[ks]]]


          or



          lst = Thread@Log10[ks], aa1 // N


          Which then yields the final plot



          enter image description here






          share|improve this answer






















          • Extremely sorry, It's my mistake, I did not give attention to missing aa1[[i]]. Thanks for your time.
            – vijay
            6 hours ago














          up vote
          4
          down vote



          accepted










          In your definition of lst, I believe you forgot to add the Part specification on aa1.



          lst = N[Table[Log10[ks[[i]]], aa1[[i]], i, Length[ks]]]


          or



          lst = Thread@Log10[ks], aa1 // N


          Which then yields the final plot



          enter image description here






          share|improve this answer






















          • Extremely sorry, It's my mistake, I did not give attention to missing aa1[[i]]. Thanks for your time.
            – vijay
            6 hours ago












          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          In your definition of lst, I believe you forgot to add the Part specification on aa1.



          lst = N[Table[Log10[ks[[i]]], aa1[[i]], i, Length[ks]]]


          or



          lst = Thread@Log10[ks], aa1 // N


          Which then yields the final plot



          enter image description here






          share|improve this answer














          In your definition of lst, I believe you forgot to add the Part specification on aa1.



          lst = N[Table[Log10[ks[[i]]], aa1[[i]], i, Length[ks]]]


          or



          lst = Thread@Log10[ks], aa1 // N


          Which then yields the final plot



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 6 hours ago

























          answered 6 hours ago









          That Gravity Guy

          1,839514




          1,839514











          • Extremely sorry, It's my mistake, I did not give attention to missing aa1[[i]]. Thanks for your time.
            – vijay
            6 hours ago
















          • Extremely sorry, It's my mistake, I did not give attention to missing aa1[[i]]. Thanks for your time.
            – vijay
            6 hours ago















          Extremely sorry, It's my mistake, I did not give attention to missing aa1[[i]]. Thanks for your time.
          – vijay
          6 hours ago




          Extremely sorry, It's my mistake, I did not give attention to missing aa1[[i]]. Thanks for your time.
          – vijay
          6 hours ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184263%2funable-to-understand-how-findfit-function-works%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          What does second last employer means? [closed]

          One-line joke