C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD

# averaged phase shift between two noisy signals

By : user2956799
Date : November 22 2020, 03:03 PM
I think the issue was by ths following , One option, as stated in the comments, is to preprocess your signal with a low-pass filter. This can be conveniently done in the Fourier domain. I used a multiplication of the cross-correlation function with varying cut-offs in an image registration application.
Adapted to your problem, it would look like (portions of the code copied from this excellent answer):
code :
``````N = size(vv, 1);
nfft = 2^nextpow2(2*N-1);
F=fft(vv(:,2), nfft);
M=fft(vv(:,3), nfft);

R=F.*conj(M);
``````
``````r = ones(nfft,1);

for k = 0.1:0.05:0.9
r = ifft(R(1:end-ceil(k*nfft)));
r = r.*r;
end
``````
``````rmax = max(abs(r));
x = find(abs(r) == rmax);
``````
``````f = fit((1:2*ceil(0.05*N)).', abs(r(x-ceil(0.05*N):x+ceil(0.05*N)-1)),'gauss1');
``````

Share :

## How to use the cross-spectral density to calculate the phase shift of two related signals

By : Laura
Date : March 29 2020, 07:55 AM

## identifying phase shift between signals

By : valencebond
Date : March 29 2020, 07:55 AM
I wish this helpful for you There are several ways that you can measure the phase shift between signals. Between your response, the comments below your response, and the other answers, you've gotten most of the options. The specific choice of technique is usually based on issues such as:
Noisy or Clean: Is there noise in your signal? Multi-Component or Single-Component: Are there more than one type of signal within your recording (multiple tones at multiple frequencies moving in different directions)? Or, is there just a single signal, like in your sine-wave example? Instantaneous or Averaged: Are you looking for the average phase lag across your entire recording, or are you looking to track how the phase changes throughout the recording?

## retrieve a phase from a noisy 1d periodic signal

By : Calvin
Date : March 29 2020, 07:55 AM
should help you out The FT is just a correlation of your signal with a cosine and sine wave, and the results give you phase and magnitude. Instead of doing a FT of the whole signal, just calculate the coefficient at your frequency of interest.
As for the accuracy - the longer your signal, the more 'distinct' your inspection frequency will be from adjacent frequencies, so I'm not sure you can get much more accuracy with this method without a longer sample length.
code :
``````from numpy import arange, pi, cos, dot, exp, angle
from numpy.random import rand

N = 1  # Number of cycles
t = arange(30 * N) + 1  # [1, 2 ... 30 * N]
omega = 2 * pi / 18.431
phi = -pi + 2 * pi * rand(1)[0]
x = cos(omega * t + phi)
x = x + 0.5 * rand(len(x))

coeff = dot(x, exp(-1j * omega * t))
phase = angle(coeff)

print "Actual phase:", phi
print "Calculated phase:", phase
``````

## varying phase during phase shift keying

By : Mohan Kumar
Date : March 29 2020, 07:55 AM
To fix the issue you can do Your code works fine. Maybe frequency is too high and a plot is too dense so that you can't notice it. Try with lower frequency.
Here is a code for (simplified) full modulation and demodulation:
code :
``````%% modulation
f=0.5;
t2 = 0:0.01:1;
m=[];
b = [1 0 0 1 1 1 0];
for i=1:1:length(b)
if (b(i)==1)
Modulated=10*cos(2*pi*f*t2);
else
Modulated=10*cos(2*pi*f*t2 + pi);
end
m=[m Modulated];
end
subplot(3, 1, 1)
plot(m)
title('Modulated')

%% downconversion
oscillator = cos(2*pi*f*t2);
demod = m .* repmat(oscillator, 1, length(b));
subplot(3, 1, 2)
plot(demod)
title('Downconverted')

%% demodulation
d = [];
for i = 1:1:length(b)
idx_start = (i - 1) * length(t2) + 1;
idx_end = i * length(t2);
Demodulated = mean(demod(idx_start:idx_end));
d = [d Demodulated];
end
subplot(3, 1, 3)
plot(d, 'x')
title('Demodulated (LPF)')
``````

## How can I calculate what the phase shift needs to be so I can get two signals with different frequencies to line up at 9

By : pgraham3
Date : March 29 2020, 07:55 AM
I wish this helpful for you It's not a matlab question it's just a mathematical question:
you have:
code :
``````sin(b1*(x-c1)) = sin(b2*(x-c2))
b1*(x-c1)      =  b2*(x-c2)
c2             = x-(b1*(x-c1))/b2
``````
``````c2 = rad2deg(x-(b1*(x-c1))/b2) = 30°
``````