Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2007-05-19 08:08:11

percepts
Member
Registered: 2007-05-19
Posts: 5

How do I linearise a curve

Hi,

I have taken some measurements which are:

21,24,29,38,53,72

the unit of difference between each measurement is 1 (actually 1 stop of light less for each measurement. i.e. half the brightness each time).

the measuring device is obviously not linear in its response. Is there a way to calculate a formula to apply to reulting measuremnts so that when graphed the line is linear? The curve currently produced seems quite smooth so I thought it may be possible to do this.

thank you.

Offline

#2 2007-05-21 16:26:34

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: How do I linearise a curve

Note that your six numbers can be closely arrived at by summing 3 numbers:
  20, x squared, and x minus 2 squared.

20 20 20 20 20 20
1   4  9  16 25 36
         1   4  9   16     +
_____________________
21 24  30 40  54 72


igloo myrtilles fourmis

Offline

#3 2007-05-21 23:31:09

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: How do I linearise a curve

Very good approximation there, John. I tried working out the exact polynomial, and it got into quintics with tiny coefficients and it was very complicated.

I should point out that (1-2)² = 1, so the first number should be 22, but other than that, very impressive.

As for the original question, I'm not sure why you'd want to draw a line of best fit on there. The graph is clearly a curve, and drawing a line wouldn't give you a representation nearly as close as John's. If you really want to though, I think Excel can do a regression on it for you.


Why did the vector cross the road?
It wanted to be normal.

Offline

#4 2007-05-22 01:45:44

George,Y
Member
Registered: 2006-03-12
Posts: 1,379

Re: How do I linearise a curve

Impresive indeed...


X'(y-Xβ)=0

Offline

#5 2007-05-23 09:20:25

percepts
Member
Registered: 2007-05-19
Posts: 5

Re: How do I linearise a curve

Thanks guys,

so if I understand this correctly, to calculate the difference on the x axis (which is what I need to do) between any two readings I would have to solve:

reading1 = 20 + x1^2 +(x1-2)^2

reading2 = 20 + x2^2 +(x2-2)^2

I would have to calculate  x1 and x2. then find the square root of each and then subtract root of x1 from root of x2 to give me the dfference along the x axis.

so I think I know what to do, but the problem for me is that I haven't solved any equations like this for 35 years and I've completely forgotten how to do it.

any clues gratefully received,

thanks

Offline

#6 2007-05-23 11:19:47

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: How do I linearise a curve

Well, according to the approximation, y = x² + (x-2)² + 20.
Simplifying gives that y = 2x² - 4x + 24.

To find x for a given y, you would first have to rearrange into standard quadratic form:
2x² - 4x + (24-y) = 0.

Then use the quadratic equation to solve, and after a bit of rearranging you get:
x = 1 ± √ (y/2 - 11)

So then to calculate the difference between any two readings along the x axis, you'd just calculate x1 and x2 using that formula and then find the difference between those.

Note that as x can't be negative, you can treat the ± as a + in this case.
Also, the formula won't work unless y ≥ 22, because otherwise you'll get a negative in the square root.


Why did the vector cross the road?
It wanted to be normal.

Offline

#7 2007-05-23 14:01:11

percepts
Member
Registered: 2007-05-19
Posts: 5

Re: How do I linearise a curve

thanks very much. That has saved me a lot of head scratching.
Maybe one day I'll understand this maths stuff.

Offline

#8 2007-05-31 23:03:24

percepts
Member
Registered: 2007-05-19
Posts: 5

Re: How do I linearise a curve

some follow up. It seems the curve is mostlikely a "cubic spline". There's some really nice free software for doing regression on curves

http://www.ebicom.net/~dhyams/cmain.htm

so I downloaded it and applied the cubic spline and it gives formula:

y = ax³ + bx² + cx + d

but that raises the question for me of: where or what are a b c and d and how do I rearrange the formula so that I  have x = f(y)

thanks again.

ps, The software allows generating a lookup table but the formula of x = f(y) would be useful.

Offline

#9 2007-05-31 23:15:58

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: How do I linearise a curve

ax³ + bx² + cx + d is just the general form of any cubic equation. If the software you downloaded can do regression then it should be able to tell you what those values are.

Excel can do regression too, and it says that the formula should be
y = 0.1481x³ - 0.5873x² - 0.2751x + 20.667.

Those are all rounded to 5 figures, so they're not exact. Fractional form would be a lot more useful, but Excel doesn't do that.

As for making x the subject, it's considerably harder to do that for cubics than it is for quadratics. It's possible, but usually left to a computer.


Why did the vector cross the road?
It wanted to be normal.

Offline

#10 2007-05-31 23:30:42

percepts
Member
Registered: 2007-05-19
Posts: 5

Re: How do I linearise a curve

mathsyperson wrote:

ax³ + bx² + cx + d is just the general form of any cubic equation. If the software you downloaded can do regression then it should be able to tell you what those values are.

Excel can do regression too, and it says that the formula should be
y = 0.1481x³ - 0.5873x² - 0.2751x + 20.667.

Those are all rounded to 5 figures, so they're not exact. Fractional form would be a lot more useful, but Excel doesn't do that.

As for making x the subject, it's considerably harder to do that for cubics than it is for quadratics. It's possible, but usually left to a computer.

Ok it was a step too far and reading further I would need those abcd numbers which would be a pain to use.
The software doesn't tell me what those numbers are although it looks as if it should.

Thanks anyway.

Offline

Board footer

Powered by FluxBB