I am trying to find the frequency difference ($\Delta f= f_1 - f_2$) between two complex sinusoidal signals using Matlab. The two signals are: $$r_1 (t)= A~ e^{j 2 \pi f_1 t}= A \cos(2 \pi f_1 t)+j A\sin(2 \pi f_1 t)$$ $$r_2 (t)= A~ e^{j 2 \pi f_2 t}= A \cos(2 \pi f_2 t)+j A\sin(2 \pi f_2 t)$$ where $f_1=150\, \text{KHz}$ and $f_2=400\, \text{KHz}$
In my Matlab code, I considered the signals are sampled at $F_s=900 \, \text{KHz}$ then
A=1;
j=sqrt(-1);
f_1=150e3;
f_2=400e3;
Fs=900e3;
n=0:1/Fs:1-1/Fs;
r1s= A*cos(2*pi*f_1*n)+1j*A*sin(2*pi*f_1*n);
r2s= A*cos(2*pi*f_2*n)+1j*A*sin(2*pi*f_2*n);
Then, to find $\Delta f$, I multiplied both signals as follows:
z= r1s.*conj(r2s);
Fz=fft(z);
subplot(2,1,1)
plot(real(Fz));
subplot(2,1,2)
plot(imag(Fz));
Then, I applied $\text{FFT}$ and plotted the real and imaginary part of the multiplication. But I could not find the pulse at $f_1 - f_2$. The pulse was at high frequency.
Also, I multiplied the two signals as
z2= r1s.*r2s;
Fz2=fft(z2);
subplot(2,1,1)
plot(real(Fz2));
subplot(2,1,2)
plot(imag(Fz2));
and applied $\text{FFT}$. The pulse was at $f_1 + f_2$, which means that what I am doing makes sense.
My question is why could I not get the frequency difference when I applied the multiplication with complex conjugate?
A
,f_1
,f_2
andFs
. Pasted code should run "as-is" $\endgroup$fft(z)
to do the FFT. $\endgroup$z= r2s.*conj(r1s);
$\endgroup$