-1
$\begingroup$

I have the following function for which I want to generate a LogPlot for:

JB[dB_, M_, a_] := (10^(dB/10) M (M - 1) (2 M - 1))/3 + ((a - 1) (2 a - 1))/(Pi^2 (a - 2))

A simple LogPlot[1/JB[x, 16, 1], {x, -40, 15}] generates the following desired output:

LogPlot

However, if I try to first generate the data and then make a plot, I get different results. Namely:

Boundresults = Table[{x, Log[1/JB[x, 16, 1]] // N}, {x, -40, 15, 0.01}];
ListPlot[Boundresults]

which generates:

ListPlot

Why are the two results different?

$\endgroup$
  • $\begingroup$ @user6014, version 11.3 $\endgroup$ – Sid May 9 at 17:14
  • $\begingroup$ If you use Log10 instead of Log you get an equivalent plot. $\endgroup$ – MelaGo May 9 at 20:16
2
$\begingroup$

To make a log plot, you need to scale both the data and the vertical axis. Your ListPlot only scales the data. Why not use ListLogPlot:

ListLogPlot[Table[{x,1/JB[x,16,1]//N},{x,-40,15,0.01}]]

enter image description here

or ListPlot with scaling functions:

ListPlot[Table[{x,1/JB[x,16,1]//N},{x,-40,15,0.01}], ScalingFunctions->{None, "Log"}]

enter image description here

$\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.