Three equations and three unknowns: fitting a function.

In summary: I was assuming that he would use my suggestion to get to that point and figure out y from there. So, I was expanding on what you had done ... not simply tossing out the idea of using your two equations. In your solution what to you do with w? I was going to leave that for him to decide.
  • #1
andrewr
263
0
Hi!

I'm doing a project with sound, and exploring modulation.
I got stuck on an intermediate step ... and can't solve a simple algebra problem.

I have a wave, which I know the envelope is a perfect sine wave, and fits the following three equations:

A * cos( ph1 ) = knownSlope1
A * cos( ph2 ) = knownSlope2
A * ( sin( ph2) - sin( ph1 ) ) = knownDeltaHeight

I need to solve for A, ph1, and ph2, where all phases ph1, ph2, are in radians.
All numbers are reals, nothing tricky...
Even if I could solve for A, and know the difference between ph1 and ph2, that would be enough... but I can't figure it out.

I've messed with this for about two hours, and am still stuck; but it's three equations in three unknowns, so it should be solvable with at least one solution...
 
Mathematics news on Phys.org
  • #2
Let's tidy this up a bit - the knowns are ##m_1##, ##m_2## and ##h##:
$$\text{(1)}\; A\cos\phi_1 = m_1\\ \text{(2)}\; A\cos\phi_2 = m_2\\ \text{(3)}\; A(\sin\phi_2-\sin\phi_2)=h$$

Your problem is the trig functions ... you can try looking for a trig identity that can simplify things down for you. Or you can find two more equations and treat the trig functions themselves as unknowns.
 
  • #3
First, quick typo fix: the second ##\phi## should have subscript 1.

andrewr, you could use pythagorean theorem along with (2) and (3) or (1) and (3) to solve for A in terms of ##\phi_1## or ##\phi_2## respectively, but you will still end up with a complicated equation. However, getting down to one variable (after putting A back into the other equation), you could use any numerical solver to give you an answer (or Newton's method on your own). There may be a better solution, but my trig has never been great.
 
  • #4
You can simplify this into a two by two system as follows:
Let r = (m1+m2)/A. Let s = h/A. Let x = phi2 and let y = phi1.

Then adding the first two equations and leaving the third alone, you get the simplified system:

cos x + cos y = r
sin x - sin y = s

Just something that's easier to work with.

Then use the sum to product formulas:
http://en.wikipedia.org/wiki/List_o...#Product-to-sum_and_sum-to-product_identities

With t = half the sum of phi1 and phi2 and u = half the difference of phi1 and phi 2.

This gives us:
2cos(t)cos(u) = r
2sin(u)cos(t) = s

Dividing the second equation by the first, we get: tan(u)= s/r and then you have the difference of the phases.

Hope that helps,
Junaid Mansuri
 
Last edited:
  • #5
Try setting ##\alpha = \frac{1}{2}(\phi_2-\phi_1)## and ##\beta = \frac{1}{2}(\phi_2+\phi_1)## and use the sum-to-product relations. It helps to rewrite (1)-(3) so they are trig-only on the LHS ... I'll start you off:

$$\text{(4)}\; \sin\phi_2-\sin\phi_1 = 2\sin\frac{\phi_2-\phi_1}{2}\cos\frac{\phi_2+\phi_1}{2}=2\sin\alpha\cos\beta =\frac{h}{A}\\
\text{(5)=(2)-(1)}\; \cos\phi_2-\cos\phi_1 = \frac{m_2-m_1}{A} = \cdots\\
\text{(6)=(2)+(1)}\; \cos\phi_2+\cos\phi_1 = \frac{m_2+m_1}{A}= \cdots $$

You may be able to divide the equations between each other to get ##\tan\alpha## and ##\tan\beta## in terms of things you know.

[edit]junaid beat me to it...
 
  • #6
Much better!

[edit]junaid beat me to it...

Yes he did, and a fine job, too! :)
However, I still need to solve for the amplitude, A.

He gave r and s in terms of divided A; which results in s/r being independent of amplitude.
But the equations for s and r, require knowing both x and y; aka phi2, and 1. not just the difference ...
So, I can't back substitute directly and solve for A...

Hmmm...
I am going to need one more relationship...
I'm going to sleep on it... perhaps I'll see it by morning. :)
 
  • #7
If you have x and y then you have r and s.
You know h - it's a given - so why not use A=h/s ?

No? if you have ##\phi_1## and ##\phi_2## then just use (1) or (2)?
 
  • #8
I think the issue he is having is that he has half the difference of phi1 and phi2 but does not know what they are specifically.

Here are some thoughts:
- It is true that s/r is independent of amplitude and using the tangent relationship, it follows that phi2 - phi1 = 2arctan(r/s) = 2arctan((m1+m2)/h). Note that phi2 > phi1 in the way that we formulated the problem. We could have switched x and y and gotten the opposite inequality, it really doesn't matter.
- Let phi2 - phi1 = D (which we will know numerically).
- Then phi2 = phi1 + D and we can reduce the number of variables in the original problem to only two: A and phi1.
- The system then becomes:
A cos y = m1
A cos (y+D) = m2

The second equation can be expanded to:
A(cos(y)cos(D) - sin(y)sin(D)) = m2

Let cos(y) = v. Then we have:
Av = m1
A(v cos(D) - sqrt(1-v^2)sin(D)) = m2
Dividing these two equations we get:
v/(v cos(D) - sqrt(1-v^2)sin(D)) = m1/m2
which is an equation in only one variable.
Cross multiplying you get:
v m2 = m1 v cos(D) - m1 sqrt(1-v^2) sin(D)
v (m1 cos(D) - m2) = (m1 sin(D))sqrt(1-v^2)
(sqrt(1-v^2))/v = (m1 cos(D) - m2)/(m1 sin(D))
(1-v^2)/v = ((m1 cos(D) - m2)/(m1 sin(D)))^2
The RHS of this equation is a constant. Once you find it, you can easily solve for v by using the quadratic formula. Then y = arccos(v).

If you can use a numerical solver however, you can directly solve:
(cos y)/cos(y+D) = m1/m2 for y. Once you know y which is phi1, we know that phi2 = y + D and A = m1/cos(y).
 
  • #9
I think the issue he is having is that he has half the difference of phi1 and phi2 but does not know what they are specifically.
Well if he only uses your two then sure - you left off the third equation: cosx-cosy=w ... but I provided that in post #5.
 
  • #10
You're right. I think using the other equation you made would make things easier. Applying sum to product with that equation you'd get -2sin(t)sin(u) = (m2 - m1)/A
Dividing this equation by the second one I had before, you get:
tan(t) = (m1 - m2)/h which you can use to find t.

Then knowing the sum of phi1 and phi2 and their difference you can find both of them. You do have to be careful about the order of the difference and be consistent otherwise you might be off by a negative in one of your equations.

Junaid Mansuri
 
  • Like
Likes 1 person
  • #11
That's how I had it in post #5 ... though I left a lot of the working out so that andrewr could have a go ;)
 
  • #12
:) I have been trying... and I wouldn't have gotten it with just the information in post #5. :(
I was able to work it all the way through, finally, today.
Thank you both.
 
  • #13
Yeah - I wrote post #5 specifically to make you work harder at it before providing additional hints.
There was sufficient information in there to do it. The lynchpin was to split the phi angles into a sum of two - you needed to know the trig relation or, at least, know to google for a list of them.

The trouble with this sort of thing is trying not to undermine the point of doing the exersize ... actually giving you all three equations turns it into pure algebra. You need to get used to approaching problems where you don't know how to proceed, without having to be told exactly how to proceed: it's what you are training for.

That trick of turning two variables into two others by half-sum and half-difference is very common in physics - you will see it again and again.
 

Related to Three equations and three unknowns: fitting a function.

1. What does it mean to fit a function?

Fitting a function refers to finding a mathematical equation or model that closely matches a set of data points. This allows us to make predictions or draw conclusions about the data.

2. Why are three equations and three unknowns important?

In order to fully determine a mathematical function, we need at least the same number of equations as the number of unknown variables. With three equations and three unknowns, we have enough information to solve for all three variables.

3. How do you solve for three equations and three unknowns?

We can use a variety of methods to solve for three equations and three unknowns, such as substitution or elimination. These methods involve manipulating the equations to isolate one variable at a time and then solving for its value.

4. What types of functions can be fit using three equations and three unknowns?

Three equations and three unknowns can be used to fit a wide range of functions, including linear, quadratic, cubic, and exponential functions. However, the data points must be able to fit a specific pattern or trend in order for the function to accurately represent the data.

5. How do you determine if a function is a good fit for the data?

One way to determine if a function is a good fit for the data is by calculating the residual, which is the difference between the predicted values from the function and the actual data points. A smaller residual indicates a better fit. Other methods include visually comparing the function to the data points and calculating the coefficient of determination (R2), which measures the proportion of variation in the data that is explained by the function.

Similar threads

Replies
2
Views
1K
Replies
9
Views
1K
Replies
9
Views
2K
Replies
4
Views
1K
Replies
4
Views
475
  • General Math
Replies
5
Views
2K
  • Classical Physics
Replies
3
Views
612
Replies
6
Views
2K
Replies
8
Views
955
Replies
1
Views
171
Back
Top