Solving equation with two unknowns?

  • Thread starter simpComp
  • Start date
  • Tags
    Unknowns
In summary, the conversation discusses the process of creating a mathematical model for a curve and determining the correct equation to use. The individual is trying to find the equation for a proximity sensor and is considering using a least-squares regression to fit the data points. They are also exploring other methods, such as creating a table of points and using interpolation.
  • #1
simpComp
44
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: 425
Mathematics news on Phys.org
  • #2
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:
  • #3
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: 438
  • 2u-B.jpg
    2u-B.jpg
    22.6 KB · Views: 418
  • 2u-C.jpg
    2u-C.jpg
    16.3 KB · Views: 450
  • #4
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.
 
  • #5
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 -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^.
 
  • #6
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?
 
  • #7
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!
 
  • #8
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.
 
  • #9
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 independant 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:

1. How do you solve an equation with two unknowns?

To solve an equation with two unknowns, you need to have two equations with the same two unknown variables. Then, you can use algebraic methods such as substitution, elimination, or graphing to determine the values of the unknown variables.

2. What is the purpose of solving an equation with two unknowns?

The purpose of solving an equation with two unknowns is to find the values of the unknown variables that satisfy both equations simultaneously. This can help in finding solutions to real-life problems and understanding relationships between variables.

3. Can an equation with two unknowns have more than one solution?

Yes, an equation with two unknowns can have more than one solution. This means that there can be multiple combinations of values for the unknown variables that satisfy the equations and make them true.

4. What happens if there is no solution to an equation with two unknowns?

If there is no solution to an equation with two unknowns, it means that there is no combination of values for the unknown variables that can satisfy both equations simultaneously. This could indicate that the equations are contradictory or that there is not enough information to solve the equations.

5. What are some real-life applications of solving equations with two unknowns?

Solving equations with two unknowns can be used in many fields, such as physics, chemistry, economics, and engineering. For example, it can be used to analyze the relationship between two variables, determine optimal solutions for a problem, or predict the behavior of a system.

Similar threads

Replies
10
Views
2K
Replies
2
Views
868
Replies
8
Views
1K
Replies
4
Views
808
Replies
1
Views
391
Replies
2
Views
247
  • General Math
Replies
13
Views
1K
  • General Math
Replies
11
Views
1K
Replies
9
Views
2K
Replies
9
Views
2K
Back
Top