I would like to understand what's happening to a signal emitted from a moving source and arriving to a moving receptor. But, when I am looking on internet about Doppler effect, I can only find equations linking received frequency to emitted frequency. But what I want to do here is to simulate the Doppler effect on a random signal in Matlab.
Introduction
My idea was to see the Doppler effect as a consequence of the movement between source and receptor, I started by writing something like this :
$$S_r(\phi(t)) = S_e(t)$$
Where $S_e$ is the emitted signal, $S_r$ the received signal and $\phi(t)$ a function giving the arrival time of the signal emitted by the source at time $t$, I think the quantity $\phi(t) - t$ is called TDOA sometimes. Since I'm using classic physics here, I have $\phi(t) = t + \frac{d_t(t)}{c}$ where $d_t(t)$ is the absolute distance travelled by the signal emitted at time $t$ between the source and the receiver.
Application to a simple problem
Let's now consider a moving emitter and a immobile receiver. To simplify things, both start at the same point with $d_e(0) = d_r(0) = 0$. Taking an immobile receiver will simplify the formula of $d_t(t)$, because in this case $d_t(t) = v_et$. Well I just have to apply my formula now, and I obtain
$$S_r\left(t + \frac{v_et}{c}\right) = S_e(t) \implies S_r(t) = S_e\left(t - \frac{v_et}{c}\right)$$
Application to periodic wave
Well, I tried to apply this simple approach to a periodic wave of frequency $f_e$ in order to try to find the equation (which is a standard équation about Doppler effect):
$$f_{r}={\frac {c}{c-v_{e}}}\cdot f_{e}$$
So, I just took $S_e(t) = \cos\left(2\pi f_e t \right)$. And then :
$$S_r(t) = \cos\left(2\pi f_e \left(t - \frac{v_et}{c}\right) \right) = \cos\left(2\pi f_e \frac{c - v_e}{c} t \right)$$
And I'm finally finding... $f_{r}=\frac {c-v_{e}}{c} \cdot f_{e}$.
So... the exact opposite of what I was supposed to find. And I don't understand why... (Same thing happens when I consider a moving receptor). So my first question would be to know where my mistake is... Because when I am simulating this approach with Matlab, I find the correct answer when using a periodic wave. So for me, this method seems to work...
Questions
- Where is my mistake when applying my approach to periodic signals ?
- Is my approach good enough to modelize Doppler effect on any kind of wave ? Can I generalize it even more ?
- How can I generalize to introduce Special relativity in my equation (in order to work with fast objects like satellites) ?
Matlab source code
%% Configuration
vE = 80; % Source speed (m/s)
c = 122; % Celerity (m/s)
d0 = 0; % Initial distance between source and receiver (m)
nT = 1500; % Number of visible periods
Fc = 20; % Carrier frequency
Tc = 1/Fc; % Carrier period
Fs = 1000; % Sampling frequency
%% Script
% Create signal
At_t = 0:1/Fs:nT*Tc;
At = cos(2*pi*Fc*At_t);
% Apply Doppler
dp = abs(d0 - vE .* At_t);
dt = dp ./ c;
% Interpolation/Resampling
do_At_t_temp = At_t + dt;
do_At_t = min(do_At_t_temp):1/Fs:max(do_At_t_temp);
do_At = interp1(do_At_t_temp, At, do_At_t);
% Plot
figure;
plot(At_t, At); hold on;
plot(do_At_t, do_At);
grid;
legend('Without doppler', 'With Doppler');
figure;
[pxx,f] = pwelch(At,[],[],[],Fs);
plot(f, pxx); hold on
[pxx,f] = pwelch(do_At,[],[],[],Fs);
plot(f, pxx);
legend('Without doppler', 'With Doppler');
xlim([0, 3*Fc])
grid;
fprintf('Theorical values : %d Hz and %d Hz\n', round(Fc * c / (c - vE), 2), round(Fc * c / (c + vE), 2));
This script seems to give the correct frequency shift (from 20Hz to 12.08 Hz)