Message Boards Message Boards

Create LogLogPlot of power function?

Posted 7 years ago

hello one and all,

I can not figure out why Mathematica will not plot this function under the LogLogPlot fxn. here is my code:

data = {{.1, 99}, {.02, 50.2}, {.004, 25.9}, {.0008, 13.4}, {.00016, 
   6.7}, {.000032, 4.1}, {.0000064, 3.1}}
p1 = ListLogLogPlot[data, PlotStyle -> {Red, PointSize[0.015]}];
p2 = ListPlot[data, PlotStyle -> {Red, PointSize[0.015]}];
q1 = Log[ems - a] == m Log[conc] + b
q1s = Solve[q1, ems];
q2 = Normal[q1s][[1, 1, 2]]
nlf1 = NonlinearModelFit[data, q2, {m, b, a}, conc];
nlf1P = nlf1["BestFitParameters"]
q3 = Normal[nlf1]
LogLogPlot[q3 /. nlf1P, {conc, 0, .11}]
Show[{p1, LogLogPlot[q3 /. nlf1P, {conc, 0, .11}]}]
Show[{Plot[q3, {conc, 0, .11}], p2}]

where the fit seems good and and plots well on the linear, linear plot, but not on the log, log plot. so let me know and thank you in advance, Lucas

POSTED BY: stephen lukacs
6 Replies

Try Evaluate around

q3 /. nlf1P 
Evaluate[q3 /. nlf1P]

and

q3
Evaluate[q3]

in your plotting functions...

POSTED BY: Sander Huisman

ok, adding Evaluate worked. but why? wouldn't any Plot function require an evaluation to plot the input function? Lucas

POSTED BY: stephen lukacs

This behavior was introduced in 11.0.0 and was changed in 11.0.1 back to original. See also:

http://community.wolfram.com/groups/-/m/t/918940?p_p_auth=gnnOy7f9

So if you update, it will be solved.

POSTED BY: Sander Huisman

ok, thank you. you're a big help. Lucas

POSTED BY: stephen lukacs

Seems to work well for me:

enter image description here

Version of Mathematica, OS. Quit your kernel, and retry? If a,b,m, ems, or conc has a value the fit might not work.

POSTED BY: Sander Huisman

well, ok? I'm using Mathematica 11. I tried SetPrecision, that doesn't do it. anything else, because I just get a blank.

POSTED BY: stephen lukacs
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract