0
$\begingroup$

I have a sequence of data:

data = {{20, 291}, {21, 440}, {22, 571}, {23, 830}, {24, 1287}, {25, 1975}, {26, 2744}, {27, 4515}, {28, 5974}, {29, 7711}};

The data is in the exponential form x1 Exp[x2 t] - x3. For some reason, I would like to transform the data to the linear form log (CR(t) + x3) first, and then transform it back to the exponential form. I would like to find the best value of x3 that can give me the best simulation. The ideal value for x3 should be around 1.1. Is there any way to do this in Mathematica?

$\endgroup$
7
  • 3
    $\begingroup$ Try this logdata=Map[{#[[1]],Log[#[[2]]]}&,data]; sol=FindFit[logdata,m*x+b,{m,b},x]; ef=E^(m*x+b)/.sol; Show[ListPlot[data],Plot[ef,{x,20,29}]] and see how close that is to what you want. If it isn't right then please explain what I've misunderstood and need to change. $\endgroup$
    – Bill
    Commented Mar 25, 2023 at 18:20
  • $\begingroup$ Thank you so much! However, when I wrote sol = FindFit[logdata, m*x + b, {m, b}, x];, it didn't work and gave me an error message saying that 0.2 is not a valid variable. I'm also confused about why 0.2 is showing up. $\endgroup$
    – yixjia
    Commented Mar 25, 2023 at 18:46
  • 1
    $\begingroup$ @yixjia Restart your kernel and try again! $\endgroup$ Commented Mar 25, 2023 at 18:47
  • $\begingroup$ Oh, I guess the problem is with my edition of Mathematica. When I tried it online, it worked. Thank you! $\endgroup$
    – yixjia
    Commented Mar 25, 2023 at 19:02
  • 1
    $\begingroup$ @yixjia Everyone wants Mathematica to be FAST! So Mathematica remembers x=0.2 and will use that each time you enter x again. And it does this for bigger expressions. You can tell Mathematica to forget by doing x=.; or by restarting Mathematica or by looking up how to use Clear or ClearAll Different subject. The value for b I found was not near 1.1. Is the value I found good? Or should the calculation be different to get closer to 1.1? Note in Mathematica Log is "natural log" $\endgroup$
    – Bill
    Commented Mar 25, 2023 at 19:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.