Applying a phase shift to a complex signal vector

31 views (last 30 days)
Hello!
I am trying to apply a phase shift to a complex signal vector for a small projecct and can't quite figure out how to do it: heres my current code:
%Form Complex matrices
x1 = complex(x1_Re, x1_Im);
x1=double(x1);
x0 = complex(x0_Re, x0_Im);
x0 = double(x0);
%Unshift the signals
Shift_tile0 = deg2rad(-151.093);
unshifted_signal0 = x0 .* exp(-1i * Shift_tile0);
Shift_tile1 = deg2rad(-86.0178);
unshifted_signal1 = x1 .* exp(-1i * Shift_tile1);
I am on MATLAB 2022b, and the sampling frequencies for x1,x0 are known. I am building x1 and x0 from the I and Q data received.

Answers (1)

William Rose
William Rose on 24 May 2024
Edited: William Rose on 24 May 2024
[Edit: In case it is not obvious, x is the original signal, and y is the phase-shifted signal.]
Since you are working with I-Q signals, make an I and Q signal that are 90 degrees apart, since this is what In-phase and Quadrature mean. In the example below, a phase shift of -60 degrees is applied.
dt=1e-2; t=(0:99)*dt; % time vec tor (s)
T=0.2; % period (s)
x=cos(2*pi*t/T)+1i*sin(2*pi*t/T);
% Apply phase shift
phi=-pi/3;
y=x*exp(1i*phi);
% Plot results
figure
plot(t,real(x),'-r',t,imag(x),'-b',t,real(y),'--r',t,imag(y),'--b');
legend('x_{Real}','x_{Imag}','y_{Real}','y_{Imag}');
xlabel('Time (s)'); ylabel('Amplitude')
Looks reasonable. Good luck.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!