Creating and recovering a frequency shift in time domain in MATLAB

In summary: Additionally, for the red plot, it seems like there might be an error in the code for reconstructing the original signal. Make sure to check that the phase is correctly calculated and applied in the reconstruction process. In summary, it looks like there may be errors in the code for both the modification and reconstruction processes, resulting in incorrect plots. Make sure to carefully check and correct these errors to get the desired results.
  • #1
tworitdash
108
26
I am trying to simulate and process the Doppler signals. My main problem is a little more complex so I am only posting a simple version of it. Task1: I have a time-domain signal with the velocity of the target as mu. I need to change the velocity to mu cos(theta) where theta is a vector from 0 to 2 pi with the same number of points that I have in the time domain signal. So, every point in the original time-domain signal should have this change. This means that the Doppler frequency (velocity) is not constant with time. Task2: Then, after I get this signal, I want to recover the original spectrum (with constant velocity) but without knowing mu. I just need to know the phase and then modify it somehow to get the real signal.
Task1 and Task2:
 clear;
    close all;
    
    lambda = 0.03;
    M = 61;
    hs = 128;
    
    N = hs * M; % Number of points in the time axis
    
    mu = 4; % Doppler velocity
    
    
    PRT = 1e-3;  % Time step
    
    t1 = 0:PRT:(N - 1)*PRT; % Time axis
    
    
    s_ = exp(1j .* 4 * pi ./ lambda .* mu .* t1); % Original Time domain signal
    
    s_f = fftshift(fft(s_)); % FT of the original time domain signal
    
    v_amb = 7.5;
    
    v_axis = linspace(-N/2, N/2-1, N)/N .* 2 * v_amb; % Velocity axis
    
    figure; plot(v_axis, db(abs(s_f))); title('Original spectrum') % Original spectrum
    %% Task1:
    BW = 1*pi/180;
    p0 = 0*pi/180;
    p1 = 360*pi/180;
    th = linspace(p0, p1, N); % Angle axis for cos(theta)
    
    
    s_man_ = abs(s_) .* exp(1j .* (angle(s_)) + 1j * 4*pi/lambda * mu * (cos(th) - 1) .* t1); % Modified time domain signal with cos(theta)
    
    s_man_f_full = fftshift(fft(s_man_)); % FT of the modified time domain signal
    
    %% Task 2
    
    s_man_comp = abs(s_man_) .* exp(1j .* (angle(s_man_)) ./ cos(th)); % Reconstruction of the original signal in time domain
    
    s_man_comp_f = fftshift(fft(s_man_comp)); % FT of the reconstructed signal
    
    figure(1); hold on; plot(v_axis, db(abs(s_man_f_full)));
    
    hold on; plot(v_axis, db(abs(s_man_comp_f)));
    
    legend({'HD spectrum', 'Manipulated with cosine Spectrum', 'Compensated from Manipulated spectrum'});  grid on;
The figure is shown below. The Yellow plot should resemble the blue blot but it doesn't. Any idea what I do wrong here? The red plot also should show multiple spikes in the plot and not like a noise signal like this I suppose.
JPflc.png
 
  • Like
Likes Delta2
Physics news on Phys.org
  • #2
It looks like you are not correctly modifying the signal with the cosine theta vector. The theta vector should be used to modify the phase of the signal, not its amplitude. Try modifying the signal with a phase shift equal to mu * (cos(theta) - 1) * t1 and see if you get the desired results.
 

FAQ: Creating and recovering a frequency shift in time domain in MATLAB

How do I create a frequency shift in time domain in MATLAB?

To create a frequency shift in time domain in MATLAB, you can use the fft and ifft functions. First, use the fft function to convert your signal into the frequency domain. Then, multiply the frequency domain signal by a complex exponential with the desired frequency shift. Finally, use the ifft function to convert the signal back to the time domain.

Can I recover the original signal after applying a frequency shift in time domain?

Yes, you can recover the original signal by using the inverse of the frequency shift process. First, apply the inverse frequency shift by multiplying the frequency domain signal by a complex exponential with the negative of the desired frequency shift. Then, use the ifft function to convert the signal back to the time domain.

How do I specify the frequency shift in MATLAB?

To specify the frequency shift in MATLAB, you can use the fs parameter in the fft function. This parameter represents the sampling frequency of the input signal and is used to determine the frequency range of the output signal. By changing the fs value, you can effectively shift the frequency of the output signal.

Can I apply a frequency shift to a specific frequency range?

Yes, you can apply a frequency shift to a specific frequency range by first using the fft function to convert the signal into the frequency domain. Then, you can manipulate the frequency domain signal by multiplying the desired frequency range by a complex exponential with the desired frequency shift. Finally, use the ifft function to convert the signal back to the time domain.

Are there any other methods for creating and recovering a frequency shift in time domain in MATLAB?

Yes, in addition to using the fft and ifft functions, you can also use the fftshift and ifftshift functions to create and recover a frequency shift in time domain in MATLAB. These functions shift the frequency range of the signal before and after the fft and ifft operations, respectively.

Similar threads

Replies
10
Views
2K
Replies
16
Views
14K
Replies
17
Views
2K
Replies
14
Views
6K
Replies
4
Views
6K
Replies
3
Views
2K
Back
Top