# Straight Line Plotting - Graph Help Please!

## Recommended Posts

Hi all, I'm at my wits end with this physics graph data.

I am measuring the change in momentum of an object from velocity readings before and after a collision. I plotted the data, and I'm now attempting to plot the data to get a straight line.

The only problem is, my data has a known y intercept. That is, I know that when x = 0, y = some number, not 0. The graph will not pass through the origin.This invalidates the idea of a direct relationship, but is also posing some frustrations to graph fitting. As it stands, the line of best fit does not accurately fit my data, so i need to change the x or y axis axes to fit the data to a straight line, as per IB standards.

The only problem is, I don't know how i can change the x axis with a known intercept. Graphing y vs. sqrt(x) to find sqrt(k) is all fine, but that only works for y = kx correct? In other words, my question is how would my graph be represented if i graphed y vs. sqrt(x) if my relationship is known to be y = kx + b? How would i calculate k and b in this situation?

Thanks for any help!

##### Share on other sites

What software are you plotting the data on?

##### Share on other sites

I am plotting the data on excel. Excel does have a function to set the y intercept, but then my line of best fit is terribly wrong. I need to fit the data somehow, but I am confused on how altering the x or y axis values will affect my new y intercept.

Edited by Tjornan

##### Share on other sites

Urgh I hate using excel for these things, it doesn't give you flexibility at all. The only thing you can do on excel in this situation is ask for the fitted line to run through the origin, or ask it not to run through the origin. If I remember correctly, you need to right click on the fitted line and choose the settings or what ever and there should be a menu there for you to decide whether you want to set b=0 or not.

The way it calculates the value of b is essentially by taking the mean of your Y values! I'm guessing your fitting a line on a scatter plot but you have observations for Y when X=0. You can't get the line go through that point I'm afraid because regressions don't work that way

##### Share on other sites

Thanks for the info Lc! I now understand that i cant get excel to fit my b value.

But i still have my other question. If i have the supposed relationship y = kx, and i graph y vs. sqrt(x), my gradient should be sqrt(k). But if my known relationship has a y intercept (as mine does), and i graph y vs. sqrt (x), like as in y = sqrt (kx + b) how do i calculate the gradient and b value from this new representation? The line fitted to this data wont be just have a gradient of sqrt(k), as the b value does not just disappear. How does one proceed from here?

Edited by Tjornan

##### Share on other sites

Why are you trying it that way? You could essentially avoid having to do the algebra by just fitting a line by choosing the functional form from the trend line options.

Try choosing the linear one and then the logarithmic one and see which one has the higher R squared. Do you know what R squared is?

##### Share on other sites

This is not a double post:

I don't think our timezones are the greatest to solve this problem today as I'm heading to bed. However I thought I'd explain why I suggested the functional form rather than pre-empting the square root relationship.

Essentially by choosing one of the different functional forms from the list on the excel options, it is transforming your data before running the regression. So the equation you get by clicking on show equation would be the values of k and b without you having to work out any algebra

Hope that helps!

##### Share on other sites

I am aware what the R squared value means.
Oh I see, I was under the impression IB requires you to format the x axis and THEN run a linear regression of the data, not a formatted function like natural log. I was told this by my teacher. But I think this has helped me clear up some of my concerns, thanks!

##### Share on other sites

I am aware what the R squared value means.

Oh I see, I was under the impression IB requires you to format the x axis and THEN run a linear regression of the data, not a formatted function like natural log. I was told this by my teacher. But I think this has helped me clear up some of my concerns, thanks!

Ah I don't know what the IB requirements are on this (I know I'm being useless) so I would recommend you go with what your teacher says!

But to keep with the guidelines, you could log your data manually and then run a linear regression line instead of choosing the log functional form from the options. That's essentially the same thing?

Sorry if I've confused things even more.

## Create an account

Register a new account