3
$\begingroup$

I'm completely new to Mathematica and trying to figure some stuff out as a first practical project. I'm trying to plot a calibration curve to fit some data to. As my first step I'm attempting to graph the calibration curve as a line graph. I have a list of "bins" that specific energy levels of particles go into (in keV), but the scale for the bins isn't linear. I'm trying to get a graph of 10 data points. I'm basically trying to get mathematica to draw a line between each of these data points using the bin # as the X axis while filling in the distance between bins. For example drawing a curved line between bin 0 with a value of 2.94, 50 with a value of 10.89, 845 with a value of 138.92 and so on. I have 10 values, but can't figure out what kind of line plot would use the bin numbers as an X axis marker and fill in the blanks between each keV point, or how to enter the command in the first place. Each bin represents a value from a gamma spectrograph, and the keV value represents the energy at a given point.

$\endgroup$
  • $\begingroup$ maybe just ListPlot with Joined True ? Its not very clear what you are asking $\endgroup$ – george2079 Nov 12 '16 at 12:39
2
$\begingroup$

You can use Interpolation

data = {{0, 2.94}, {50, 10.89}, {845, 138.92}};

energy = Interpolation [data, InterpolationOrder -> 2];

With the complete data set, a higher interpolation order can be used.

{binMin, binMmax} = MinMax[data[[All, 1]]];

Plot[energy[bin], {bin, binMin, binMmax},
 Frame -> True,
 Axes -> False,
 FrameLabel -> (Style[#, 14, Bold] & /@
    {"Bin Number", "Energy Level (keV)"})]

enter image description here

$\endgroup$
  • $\begingroup$ This worked perfectly. Now I just have to fit a bunch of data to the curve this is generating! $\endgroup$ – Josh Lucy Nov 14 '16 at 20:30

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.