INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Pythagorean Theorem with negative numbers

Pythagorean Theorem with negative numbers

(OP)
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

RE: Pythagorean Theorem with negative numbers

Multiply by the SIGN() of the original signals.

RE: Pythagorean Theorem with negative numbers

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: Eng-Tips.com Forum Policies
[IMG http://tinyurl.com/7ofakss]
Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers


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: http://www.engineering.com/AskForum/aff/32.aspx

RE: Pythagorean Theorem with negative numbers

(OP)
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.

RE: Pythagorean Theorem with negative numbers

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: Eng-Tips.com Forum Policies
[IMG http://tinyurl.com/7ofakss]
Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers


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: http://www.engineering.com/AskForum/aff/32.aspx

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close