Calculation of phase of signal
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Omkar Vaze
am 13 Dez. 2021
Bearbeitet: Chunru
am 30 Dez. 2021
I have generated two signals with two different frequencies keeping the amplitude same for both signals. The signals are shown in below
image.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/833210/image.png)
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 Kommentar
Akzeptierte Antwort
Chunru
am 30 Dez. 2021
Bearbeitet: Chunru
am 30 Dez. 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])
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matched Filter and Ambiguity Function finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!