Calculation of phase of signal

6 visualizaciones (últimos 30 días)
Omkar Vaze
Omkar Vaze el 13 de Dic. de 2021
Editada: Chunru el 30 de Dic. de 2021
I have generated two signals with two different frequencies keeping the amplitude same for both signals. The signals are shown in below
image.
As seen in the figure there is gap between first signal(blue) and second signal(red). I am trying to remove this gap by adjusting the phase of second signal. But I am not able to calculate the phase difference between these two signals. I am trying to write a code in which it will calculate the phase of next signal by itself and join the signals together.
The equation I used to generate the signal is
x=sin(2*pi*f*t +phase);
All suggestions are welcome. Thank you in advance
  1 comentario
yanqi liu
yanqi liu el 30 de Dic. de 2021
yes,sir,my be just use cat to merge vector

Iniciar sesión para comentar.

Respuesta aceptada

Chunru
Chunru el 30 de Dic. de 2021
Editada: Chunru el 30 de Dic. de 2021
fs = 50;
ns1 = 200; % samples for x1
f1 = 1;
x1 = sin(2*pi*f1*(0:ns1-1)/fs); % first part
% Try to make the fist point of x2 close to last point of x1
x20 = sin(2*pi*f1*ns1/fs);
% This is to say the phase for x2:
phi2 = 2*pi*f1*ns1/fs;
% To make x1 and x2 connected without gap
% phi2 = 2*pi*f1*(ns1-1)/fs;
% but this will give a flat signal between ns1 and ns1+1
ns2 = 300;
f2 = 0.5;
x2 = sin(2*pi*f2*(0:ns2-1)/fs + phi2);
figure;
plot((0:ns1-1)/fs, x1); hold on
plot((ns1+(0:ns2-1))/fs, x2);
figure;
plot((0:ns1+ns2-1)/fs, [x1 x2])

Más respuestas (0)

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by