Plotting a linear graph with non-linear values

485 Views Asked by At

I am having trouble figuring out how to plot the data below in a linear fashion. What I want is a straight line that relates temperature (left column) and heat capacity (right column) and I'm not sure how to scale the x and y axes appropriately. I have been provided the equation $C_{v} = AT + BT^{3}$ where C is heat capacity, T is temperature and A and B are constants that I need to find. I have also been provided a table a values that I need to plot linearly. If someone can show me how to scale the x and y axes to get a straight line, that would be fantastic!

  1.00 ,   2.0100
  2.00 ,   4.0800
  3.00 ,   6.2700
  4.00 ,   8.6400
  5.00 ,  11.2500
  6.00 ,  14.1600
  7.00 ,  17.4300
  8.00 ,  21.1200
  9.00 ,  25.2900
 10.00 ,  30.0000

Also as a side note, I need to figure out what the constants A and B are, but I can't figure those out before graphing the values.

Thank you.

2

There are 2 best solutions below

0
On

The question you ask is a standard linear regression problem. Your function $C_v=AT+BT^3$ is indeed not linear in $T$, but it is linear in $A$ and $B$, which is all that matters.

A transformation that maps your data to a straight line exists, but you will not find it without knowing $A$ and $B$, and you do not need to find it to learn the values of $A$ and $B$. Wikipedia has a good explanation.

Your function can be written in matrix form $$\left[\begin{matrix}2.0100\\4.0800\\ \vdots \\ 30.0000 \end{matrix}\right]=\left[\begin{matrix}1 & 1^2 \\ 2 & 2^2 \\ \vdots & \vdots \\ 10 & 10^2\end{matrix}\right]\left[\begin{matrix}A\\B\end{matrix}\right]\\ Y=X\left[\begin{matrix}A\\B\end{matrix}\right]$$ These equations are overdetermined and need to be solved in least squares sense $$\left[\begin{matrix}A\\B\end{matrix}\right]=(X^TX)^{-1}X^TY$$

0
On

If you want to plot the data below in a linear fashion, you could write $$\frac{C_v} T=A + B\, T^2$$ So define $y=\frac{C_v} T$ and $x=T^2$ to have $y=A+Bx$.

But you must take care that the results would not be the same fitting the first and second models (except in the very ideal case where the data would be perfectly exact).

For the second model, this would give you the following values to plot

$$\left( \begin{array}{cc} x=T^2 & y=\frac{C_v} T \\ 1 & 2.01 \\ 4 & 2.04 \\ 9 & 2.09 \\ 16 & 2.16 \\ 25 & 2.25 \\ 36 & 2.36 \\ 49 & 2.49 \\ 64 & 2.64 \\ 81 & 2.81 \\ 100 & 3.00 \end{array} \right)$$ and these seem to be perfectly aligned. You would get the values by eye.