logo
down
shadow

averaged phase shift between two noisy signals


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 : facebook icon twitter icon
How to use the cross-spectral density to calculate the phase shift of two related signals

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

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

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

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

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°
Related Posts Related Posts :
  • MATLAB: Failed to correctly write using csvwrite()
  • Matlab: directly access a specific return value of functions
  • How to apply a polynomial to a sequence
  • Anonymous Function with changing array size
  • How to represent double type number in binary form?
  • increase / decrease the frequency of a signal using fft and ifft in matlab / octave
  • How to calculate distance between two set of coordinates in meter?
  • multiple colorbar in ocatve
  • how to alter the range of values of a plot generated by spectrogram function
  • How do I transform a column of data into a normal distribution in MATLAB?
  • Matlab Not enough input arguments
  • Unable to print character value received on serial port in Matlab
  • Blocking Ctrl-C / Ctrl-Z in an input command
  • Find all mappings between two binary vectors of same size?
  • Color correcting images in MATLAB
  • Questions about lowpass filters using 'butter' function in Matlab
  • Nested Bluetooth callback in Matlab GUI
  • How to select random numbers from a given list in matlab / octave
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org