Solving equation with two unknowns?

  • Context: High School 
  • Thread starter Thread starter simpComp
  • Start date Start date
  • Tags Tags
    Unknowns
Click For Summary

Discussion Overview

The discussion revolves around finding a mathematical equation to model a curve based on observed data points from a proximity sensor's measurements. Participants explore the formulation of a quadratic equation with two unknowns and the challenges associated with fitting the equation to multiple data points.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant proposes the equation format f(x) = x^ - ax + b based on a curve they have plotted, but expresses uncertainty about its correctness.
  • Another participant suggests that two equations are needed to solve for two unknowns and recommends selecting an additional point for this purpose.
  • Concerns are raised about the initial equation's clarity, with participants questioning whether it represents a quadratic function.
  • A participant mentions that their calculations for a third data point do not align with the expected value, raising doubts about the equation's accuracy.
  • Discussion includes the suggestion to use a least-squares regression approach to fit a quadratic function to multiple data points rather than relying on just two points.
  • One participant describes the context of their measurements and the relationship between current steps and detection range, providing specific data points for analysis.
  • Another participant highlights the need for a coefficient on the x^2 term and discusses the implications of fitting a curve to selected points.
  • There is a proposal to solve for three unknowns using three different points to potentially improve the accuracy of the model.

Areas of Agreement / Disagreement

Participants express differing views on the correctness of the proposed equation and the method for determining it. There is no consensus on the best approach to model the data accurately, and multiple competing ideas are presented regarding the use of data points and fitting methods.

Contextual Notes

Participants note limitations in the initial equation's clarity and the need for additional data points to achieve a reliable fit. The discussion reflects uncertainty about the appropriateness of the quadratic model and the assumptions underlying the data fitting process.

Who May Find This Useful

This discussion may be useful for individuals interested in mathematical modeling, curve fitting, and data analysis, particularly in the context of experimental measurements and sensor data interpretation.

simpComp
Messages
44
Reaction score
0
Hello,

Okay, I have finally worked out a decent curve to work with which is in accordance with my previous post called "How to create a simple mathematical model".

According to the attachment in this thread, I have deemed the following equation format as respective to the curve in my attachment.

f(x) = x^ -ax + b

I could be wrong about this... but it's what I think... please let me know if I am incorrect in my assumption.

I have selected one coordinate in the curve which is (30, 124) and I would like to complete the equation above using this coordinate.

So I tried:

f(x) = x^ -ax + b
124 = 30^ - 30a + b
0 = 900 - 124 - 30a + b
0 = 776 - 30a + b

I don't quite remember how to solve for a and b. Can someone please show me how to solve this equation which has two unknowns!

All help or tutorial links is appreciated!

thanks
 

Attachments

  • C6.jpg
    C6.jpg
    30.6 KB · Views: 501
Mathematics news on Phys.org
you need two equations for two unknowns so pick another point and do the same.

then solve the first in terms of b ie b=
then plug the b= stuff into the second equation
the second should now contain only a values so solve for a
lastly take the a you got (its a number) put into the b= equation and now you'll have b too​

WAIT is your eqn a line eqn or is that x to some power -ax?

Your graph doesn't show a line so is your equation really this?

y = x -ax + b
 
Last edited:
Hello jedishrfu,

Thanks for replying.

Okay, I tried it and the two equations worked out, but when I tried to get a third
value by using the know values of a and b it didn't work !

When x = 6, according to graph, its supposed to be 101??

Please view the mathematical work in the three attachments below!

Thanks!
 

Attachments

  • 2u-A.jpg
    2u-A.jpg
    34.7 KB · Views: 508
  • 2u-B.jpg
    2u-B.jpg
    22.6 KB · Views: 481
  • 2u-C.jpg
    2u-C.jpg
    16.3 KB · Views: 535
I'm confused by your initial equation:

Is this your equation?

y = x 2 -ax + b

If so and you did your math correctly and the third point doesn't work then you don't have the correct equation.
 
simpComp said:
According to the attachment in this thread, I have deemed the following equation format as respective to the curve in my attachment.

f(x) = x^ -ax + b

I could be wrong about this... but it's what I think... please let me know if I am incorrect in my assumption.

I have selected one coordinate in the curve which is (30, 124) and I would like to complete the equation above using this coordinate.

So I tried:

f(x) = x^ -ax + b
124 = 30^ - 30a + b
0 = 900 - 124 - 30a + b
0 = 776 - 30a + b

You need to write what you mean. Your function apparently is f(x) = x^2[/color] -ax + b, based on your work in evaluating f(30) above.

The caret symbol, ^, does NOT mean "squared". To write the square of x and the square of 30, write x^2 or 30^2, NOT x^ or 30^.
 
Is this your equation?

y = x 2 -ax + b

If so and you did your math correctly and the third point doesn't work then you don't have the correct equation.

No, as pointed out to me, my equation is:

f(x) = x^2 - ax + b

Based on the curve's appearance that's what I believe! For points (14,114) and (30,124) the math works out. But when I do it for point (6, 101) I get 300 ? which is totally off??

I don't think I have the wrong equation, but if I do have the wrong equation then how does one feel out the correct equation ?

confused?
 
You need to write what you mean. Your function apparently is f(x) = x^2 -ax + b, based on your work in evaluating f(30) above.

The caret symbol, ^, does NOT mean "squared". To write the square of x and the square of 30, write x^2 or 30^2, NOT x^ or 30^.

understood!
 
are you trying to find the right equation so you can program it into some device?

If that's the case you could consider writing a table of points and then using interpolation to get intermediate values then you wouldn't need the equation at all.

Basically you'd be converting the curve into a connect the dots with line segments and using interpolation. Not perfect but hey.
 
simpComp said:
No, as pointed out to me, my equation is:

f(x) = x^2 - ax + b

Based on the curve's appearance that's what I believe! For points (14,114) and (30,124) the math works out. But when I do it for point (6, 101) I get 300 ? which is totally off??

I don't think I have the wrong equation, but if I do have the wrong equation then how does one feel out the correct equation ?

confused?

Why do you not have a coefficient on the x^2 term? Why should it be 1.0 x^2 rather than 0.9 x^2 or 1.1 x^2? If you put a coefficient on the x^2 term, that gives you three parameters to determine and you'll need at least three points to determine the curve uniquely.

Why do you expect that having selected a particular member from a family of curves based on sampling two or three points (and thereby determining two or three parameters) that the remaining points will neccessarily fit to the curve that you have determined?

For a polynomial equation like this, a "least-squares" regression may be usefully applied. Instead of fitting to two points exactly, you fit to n points so that the total deviation is minimized. For a least-squares regression in particular, what you try to minimize is the sum of the squared deviation of each point from the selected curve.

Least squares fit to a quadratic function is a very standard thing to want to do. Google it.
 
  • #10
hi jedishrfu,

I have a proximity sensor that detects 0-240" based on 0-135 steps of infra red light emitted by an LED. For my led, I have a current source that can go from 0 ma to approximately 40 ma. I can increment my current source in 135 steps. Therefore, when my current source is at 0 steps, I have 0 ma through the led and therefore the detector has a maximum detection range of 0".

Every step I increment my current source, the current through the led increments exponentially from 0 ma to 40 ma. The relation in steps vs inches is the graph I plotted by doing measurements myself.

So, as shown in the graphic curve, the coordinates are selected by the following observations:

at 101 steps of current, there is enough infra red light generated from the led for the sensor to detect something at 6"...
at 114 steps of current, there is enough infra red light generated from the led for the sensor to detect something at 14"...
at 120 steps of current, there is enough infra red light generated from the led for the sensor to detect something at 22"...
at 124 steps of current, there is enough infra red light generated from the led for the sensor to detect something at 30"...
at 126 steps of current, there is enough infra red light generated from the led for the sensor to detect something at 38"...

hence coordinates:

(6, 101)
(14, 114)
(22, 120)
(30, 124)
(38, 126)

Now, I will know perhaps two points as I did in my attempt to calculate the equation above! But from those two points, I may need to know how many need to know how many steps are required for odd distances such as, 7" or 18" or 24" etc...

So based on one equation, I would like to use it to figure out the distance in inches related to any step value I want!

And I am having trouble finding that equation for this particular curve!

This curve seems like a parabola no? Its a wide parabola, but nonetheless a parabola!

As you may have noted, I only need the left half of this parabola for my values plotted!

I have an idea! Probably nothing new to you... but ... as jbriggs suggested, maybe I should try to solve for three unknowns of three different points! like this:

f(x) = ax^2 - bx + c

and do what I did for two points except I do it for three points... would this work??

again thanks for your help!
 
Last edited:
  • #11
You seem to have 5 data points. You need only to use 3 data points to make a quadratic fit, using the very simplest of linear algebra. Choose any 3 points, use them to make your system of 3 equations in which the coefficients will be the unknowns to find.
 
  • #12
You seem to have 5 data points. You need only to use 3 data points to make a quadratic fit, using the very simplest of linear algebra. Choose any 3 points, use them to make your system of 3 equations in which the coefficients will be the unknowns to find.


Like this right? :

f(x) = ax^2 - bx + c

and I would solve for a, b, c like I did before for 2 unknowns right?

thanks
 
  • #13
simpComp said:
Like this right? :

f(x) = ax^2 - bx + c

and I would solve for a, b, c like I did before for 2 unknowns right?

thanks

This assumes it is a quadratic. The only way you'll know is if the remaining two points work when you plug them into equation.
 
  • #14
wow! this is a lot of work...

its 4 times I started over lol!

Not sure if I am doing this right... but let me continue!

thanks
 
  • #15
Which quantity do you want as independent variable, and which quantity do you want as the function? Your graph looks like it shows a quadratic fit, IF you choose Distance from LED Sensor as a function of Steps of Current.
 
Last edited:
  • #16
Your listed data points:
(6, 101)
(14, 114)
(22, 120)
(30, 124)
(38, 126)

Switch coordinates:
(101, 6)
(114, 14)
120, 22
124, 30
(126, 38)

This looks like about the upper half of a parabola based on your first graph.
If you believe that the
best fit will be quadratic, I would arrange the system like this, using first,
last, and middle data points just to cover best possibilities:

a(101)^2+b(101)+c=6
a(120)^2+b(120)+c=22
a(126)^2+b(126)+c=38

The unknowns are the coefficients, a, b, and c. You may for easier processing,
form the matrix:
[10201, 101, 1, 6]
[14400, 120, 1, 22]
[15876, 126, 1, 38]

You may find reduced triangular form like
[1 -0 0 0.073]
[0 1 0 -15.287]
[-0 -0 1 805.4947]
( used the page http://www.math.purdue.edu/~dvb/gaussian.php )
 
Last edited:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 70 ·
3
Replies
70
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 14 ·
Replies
14
Views
2K