How do I shift a chirp signal to the right?

15 views (last 30 days)
Hello,
I have a challenge and I'll really appreciate some help with it.
My goal is to generate and plot the transmit and receive chirp signals on a spectrogram. I understand there a number of ways to do this but the other methods I have tried did not work for me (I probably bungled the code) but the current method does give me what I want save a few issues. The transmit signal is as I intended, showing 2 periods.
%% Given parameters
fc = 4e9; % centre freq, Hz
BW = 8e9; % bandwidth, Hz
Tp = 1e-6; % pulse width, sec
fs = 2*(fc + BW); % sampling freq, Hz
ts = 1/fs;
K = BW/Tp; % chirp rate, Hz/sec
tau = 0.2e-6; % delay, sec
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TRANSMIT
figure (1)
tee = 0:ts:Tp-ts;
Tx = exp(1j*2*pi*(fc*tee + 0.5*K*tee.^2));
t1 = Tp:ts:2*Tp-ts;
Tx1 = exp(1j*2*pi*(fc*(t1-Tp) + 0.5*K*(t1-Tp).^2));
Tx_signal = [Tx Tx1];
Tx_signal = Tx_signal/150;
spectrogram(Tx_signal,256,250,1024,fs,'yaxis');
colorbar;
caxis([-155,-98]);
ylim([0,20]);
Problems starts when I try to generate the receive signal. I have used the range equation to determine it should be start at tau = 0.2μsec on the x-axis in the first period and at Tp+tau in the second period. That is, I want to shift the transmit signal to the right by tau, to get the receive signal (since I am using the same chirp rate and single object). I used the code below to try to implement the shift.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RECEIVE
figure (2)
t2 = tee-tau;
Rx = exp(1j*2*pi*(fc*t2 + 0.5*K*t2.^2));
t3 = t1-tau;
Rx1 = exp(1j*2*pi*(fc*(t3-Tp) + 0.5*K*(t3-Tp).^2));
Rx_signal = [Rx Rx1];
Rx_signal = Rx_signal/150;
spectrogram(Rx_signal,256,250,1024,fs,'yaxis');
colorbar;
caxis([-155,-98]);
ylim([0,20]);
Instead of shifting horizontally, the signals has shifted vertically. When combined, they look like this...
% TX AND RX
figure(3)
final = [Tx Rx Tx1 Rx1];
final = final/150;
spectrogram(final,256,250,1024,fs,'yaxis');
colorbar;
caxis([-155,-98]);
ylim([0,20]);
Question
How do I get the rx signal to shift horizontally (from 0.2μ to 1.2μ and 1.2μ to 2.2μ) instead of vertically? The max t-axis should be 2.2μ not 4μ
Thank you so much in advance.

Accepted Answer

Image Analyst
Image Analyst on 26 Jun 2022
I didn't delve into the code too much but it looks like you're changing frequency so that's why it's shifting on the vertical axis. If you want to shift it along the horizontal time axis you're probably going to either have to pad your signal with zeros on the left, meaning it doesn't actually start until sometime later, or you're going to have to change the starting time from 0 in this line
tee = 0:ts:Tp-ts;
After that you may want to adjust what part of the x axis is shown by using xlim
  2 Comments
Charlie
Charlie on 26 Jun 2022
Thank you for your response.
But ts and Tp are time quantities, not freq. Could you please explain more how I can adjust them better to get the result I need?
I already tried to make the receive signal not start from zero while defining t2 and t3 but it did not work. could you please suggest another method of doing this?
Charlie
Charlie on 28 Jun 2022
@Image Analyst, thank you so much. padding zeros on the left of the rx signal worked.

Sign in to comment.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!