Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

phase shift calculation

Status
Not open for further replies.

MRSSPOCK

Mechanical
Aug 29, 2010
303
I have a sine wave plotted, i.e. y = sin(x)

I have a second wave plotted, where y = sin(2x)+1

phase_shift_required_hgvetu.jpg


I now wish to introduce a phase shift, such that the latter wave becomes tangential with the former.

Whether the shift is in the X+ or X- direction is irrelevant to me.

Can anyone please explain how to calculate this phase shift, and illustrate it with an Excel graph, to show that the results of the calculation actually do provide the correct phase shift to create the condition where the waves are actually tangential at certain periodic instants.

Thanks
 
Replies continue below

Recommended for you

With different frequencies you will not get a phase shift. You will get the sum and the difference of the two original frequencies.

Bill
--------------------
"Why not the best?"
Jimmy Carter
 
Sorry but what you say just isn't true.

The two curves have a frequency ratio of 1:2, so they will be tangent on a regular basis at a certain phase shift.

I have already done it by iteration and proved it.

I just want a more methodical solution other than iteration.
 
Is this really a design problem? And that other problem of yours - was that also related to circuit design?

If this is your bread and butter, I think that you should earn it yourself.

If it is for school...

Gunnar Englund
--------------------------------------
Half full - Half empty? I don't mind. It's what in it that counts.
 
@ Skogsgurra

That was really useful.

Thanks

Why waste your time even commenting.

Do you think your comment served any purpose at all.

I know I don't.

What are you, the forum policeman or something.
 
I agree with Bill (waross), but using the terms as you've defined, this seems to be perfectly trivial.

Hint: Linear interpolation along the X axis with a period of, ah, the period.

Which puts the emphasis back on Gunnar's question. :)

Phase_cgesff.png
 
This site has quite a few forum policemen.

Guidelines are listed just below the post entry box.

Promoting, selling, recruiting, coursework and thesis posting is forbidden. - Posting Guidelines
 
That does not seem to be what the OP was asking for. She's looking for points of tangency between the two curves by changing the phase.

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529
 
"...points of tangency..."

Ah. So trivial calculus or apply 90° phase shift (same thing).

 
In the electrical fora, the term "phase shift" is most almost exclusively applied to waveforms of the same frequency.
Forgive us our confusion.
Our practical applications are too much influenced by the possible changing amplitudes of one or both waveforms to ever worry about points of tangency.
How does this apply to circuit design?

Bill
--------------------
"Why not the best?"
Jimmy Carter
 
I give up.

It appears I cannot explain the problem well enough.

Thanks for everyone's input.

If I find a solution I will post it here.

And just for anyone interested, the application is that I want to be able to generate arbitrary waves for my AWG, where the initial stage of the wave is defined by y = (sin(2x+s))+1, which then blends tangentially into y = sin (x)

Thanks
 
Good to know, at last, what the application is. If I get it right, you need to generate a waveform where one sine exist up to a certain point where it is then replaced by another sine with the condition that there is no discontinuity in the first or second derivative.

Is that right? Then tell us so. Please.

Gunnar Englund
--------------------------------------
Half full - Half empty? I don't mind. It's what in it that counts.
 
Yes that is it exactly.

The reason I didn't want to mention the application is because posts have a habit of veering off onto a different subject.

I didn't really want to go down a rabbit trail about AWG's

I just wanted to learn the mathematics to program it.
 
Your math would then need to look up the next (there are an infinite number of them) inflexion point with the correct slope (positive or negative) and then start a new sinewave with the correct delay (I prefer delay over phase shift, see Bill's comment)and starting level.

It is not a very complicated math, but it may overtax the capability of your AWG at higher frequencies and running real time. I would use a PC and an external D/A for this.

Gunnar Englund
--------------------------------------
Half full - Half empty? I don't mind. It's what in it that counts.
 
I have a sine wave plotted, i.e. y = sin(x)

I have a second wave plotted, where y = sin(2x)+1

I now wish to introduce a phase shift, such that the latter wave becomes tangential with the former.
Let me give it a try
y1 = sin(x)
y2 = sin(2x + theta)+1
y1' = cos(x)
y2' = 2*cos(2x+theta)

In order to be tangent, find x and theta such that
y1 = y2 [eq1]
y1' = y2' [eq2]


plug in definitions of y1, y2, y1', y2' to give the following:
sin(x) = sin(2x + theta)+1 [eq 1a]
cos(x) = 2*cos(2x+theta) [eq 2a]

LHS(eq1a)^2 + LHS(eq2a)^2 = 1 => RHS(eq1a)^2 + RHS(eq2a)^2 = 1
(sin(2x + theta)+1)^2 + (2*cos(2x+theta))^2 = 1
[sin^2(2x + theta) + 2*sin(2x + theta) + 1] + 4 * cos^2(2x+theta) = 1

Subtract 1 from each side
sin^2(2x + theta) + 2*sin(2x + theta) + 4 * cos^2(2x+theta) = 0

Substitute 4 * cos^2(2x+theta) = 4*(1-sin^2(2x+theta))
sin^2(2x + theta) + 2*sin(2x + theta) + 4 * (1-sin^2(2x+theta)) = 0
sin^2(2x + theta) + 2*sin(2x + theta) + 4 - 4 *sin^2(2x+theta)) = 0
-3*sin^2(2x + theta) +2*sin(2x + theta) + 4 = 0

We recognize the quadratic form az^2 + b*z + c = 0 where
z = 2*sin(2x+theta)
a = -3
b = 2
c = 4

solution z = [-b +/- sqrt(b^2-4ac)]/2a = [-2 +/-sqrt(4+48)] / (-6)
z = [-2 +/- sqrt(52)] / (-6)
arbitrarily pick try the root which is positive
z = [-2 - |sqrt(52)}[ / (-6)
z = 1/3 + |sqrt(52)|/6 = 1/3 + sqrt(52/36)
z = 1/3 + |sqrt(4/3)|
z = |sqrt(7/3)|
2*sin(2x+theta) = |sqrt(7/3)|
sin(2x+theta) = 0.5 * |sqrt(7/3)|
There are two values of the argument (2x+theta) between 0 and Pi to satisfy above.
Of course also repeating solutions separated by n*2pi

And there is another set of solutions if you pick the -sqrt
I'm not going to go there because I may have made some algebra errors already.
I leave it to whoever wants to check it...









=====================================
(2B)+(2B)' ?
 
electricpete said:
z = 1/3 + |sqrt(4/3)|
z = |sqrt(7/3)|
It looks right to me up to the first line.
The 2nd line is wrong. Edit seems broken.

=====================================
(2B)+(2B)' ?
 
Apologies that my previous attempts went off on a tangent... Trying to understand the question is often where I get confused.

Let's try again.

For 2. y = sin(2x)+1, the +1 offset has zero effect on the slope, so the +1 can simply be dropped (ignored).

For any y = sin(...), the slope (or tangent) is the derivative, which is just y = cos(...).

This derivative of any sin being cos can be done practically by noting that sin and cos are exactly the same thing, with a horizontal relative 90° phase shift (the period of each signal).

The sin wave becomes its own slope by simply kicking it sideways by 90°.

Combining the two (eliminating the unnecessary +1 vertical offset and perhaps sliding each waveform horizontally each by their own 90° to each become their own derivative) then the two new curves will obviously cross where their slopes are equal.

This answers the question to know where the slopes of the original waveform are equal.

Measuring the relative 'phase' (*) at other points is a simple linear measurement (horizontally) with a ruler, to the nearest matching point (remember that amplitude = slope).

( * The vocabulary gets a bit twisted due to the point originally raised by Bill (waross). But I think that the last step here is obvious at this point.)

I hope this helps.


 
I don't believe that the offset may be ignored. The OP is not just looking for equal slope but equal slope and equal magnitude. If the waveforms are shifted so that the peaks align then the slopes are equal but due to the offset, the waveforms are not tangent.
I don't believe that this may be solved without including the instantaneous magnitude.
Any change in either the peak to peak value of either waveform or the vertical offset between the waveforms will shift the point of tangency.
It is difficult to visualize a real world application. Given the effect of circuit loading on the magnitude of waveforms, it may be difficult to maintain exactly equal magnitudes in the real world.
Remember also that as the frequency changes, the impedance of any but a purely resistive load circuit also changes. That will change the offset between the EMF and the current waveforms. Or as, we use the term, the "Phase shift" between the EMF and the current of each signal will change.

Bill
--------------------
"Why not the best?"
Jimmy Carter
 
Respectfully,
VE1BLL said:
(remember that amplitude = slope).
If you change the offset, you change the absolute magnitude.

Bill
--------------------
"Why not the best?"
Jimmy Carter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor