Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pythagorean Theorem with negative numbers

Status
Not open for further replies.

roweder

Materials
Jun 9, 2015
2
To skip the background of my question go to the last two lines of this post.

I work in a materials science lab doing spectroscopy with a rather crude type of instrumentation. We use modulation to improve our signal to noise ratio, and we record two signals, one in phase, and one ninety degrees out of phase. So each time we use the spectrometer we record two signals, one in phase and one out of phase, and then we adjust the phasing until the entire signal is in the in phase signal, and the out of phase consists only of noise.

However for the experiment I'm currently working on, I am changing one variable while keeping all other variables the same, which means I have to keep the phase the same. But, the phase of the signal seems to be changing as I am changing my independent variable.

I have both phases recorded, one in phase, and one 90 degrees out of phase.

Since the two signals are 90 degrees from each other, this is the perfect condition to use the pythagorean theorem and sum the squares of both signals, and then take the square root of that sum. I could definitely do this to find the actual signal amplitude. HOWEVER, these signals include both positive and negative values. When I do the pythagorean theorem it churns out only positive numbers. There are also times when one phase is positive and the other is negative.

So, my question, simplified is:

I have two columns containing two phases of a modulated signal that are orthogonal to each other. How can I do a version of the pythagorean theorem in excel on these two columns each containing 4096 data points, when one or both columns is sometimes negative?

Thank you

-Derek
 
Replies continue below

Recommended for you

If you wish to calculate the phase information, you could use the ATAN2, which uniquely calculates the resultant phase, with which you can then calculate the amplitude.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529


Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
There is a homework forum hosted by engineering.com:
 
I ended up taking the absolute value of each signal, then using the Pythagorean theorem with those absolute values, and then multiplying by the sign of the average of the in phase and out of phase. This worked relatively well, and definitely works for the amplitudes. However, it doesn't quite work when the signal is close to zero.

I also tried calculating the angle between the two signals and multiplying the in phase by the cosine of that angle, and the out of phase by the sine. This method never resulted in a signal with an amplitude larger than either of the two signals.

I've attached the excel file I'm working with.
 
 http://files.engineering.com/getfile.aspx?folder=c24250d7-694b-452a-a4d5-65d799e8a060&file=Variable_Bias_2.xlsx
You do realize that squaring an absolute value is redundant? Since you are only interested in amplitude, the sign is irrelevant.

Your first tab should not have been using the average of anything, since there was no plausible reason to do so, and you didn't do anything remotely like that on the second tab. E10 should be more like:
=ABS(IF(ABS(B10)>ABS(C10),B10/SIN(D10),C10/COS(D10)))

Either way results in some pathological results.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529


Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
There is a homework forum hosted by engineering.com:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor