Merge up sweep and down sweep together in the same figure to get a chirp up and down

3 vues (au cours des 30 derniers jours)
Hi
i generated up sweep and down sweep signals and i want to merge them together to get one chirp up and down like triangular pulse
the range of time which i used to generate the sweeps was t1=0:Ts:T-Ts and t2=T:Ts:2*T-Ts
after merging the sweeps i should get a chirp with time between 0:Ts:2*T-Ts
can you help me?
clear all
clc;
fs =100e3; %sampling frequency
fc=20e3; %carrier frequency
Ts=1/fs; %sampling period
b=10e3; %Bandwidth
R=4; %initial distance of the target in [m]
T=50e-3; %Period
c=340; %speed of sound in air in [m/s]
t1=0:Ts:T-Ts; %time range for transmitted signal
t2=T:Ts:(2*T)-Ts;
Tx1 = 1*cos(2*pi*(fc-b/2)*t1+(pi*b*t1.^2/T));
subplot(2,1,1);
plot(t1,Tx1);
spectrogram(Tx1,256,240,256,fs,'yaxis');
Tx2 = 1*cos(2*pi*(fc+3*b/2)*t2-(pi*b*t2.^2/T));
subplot(2,1,2);
plot(t2,Tx2);
spectrogram(Tx2,256,240,256,fs,'yaxis');

Réponse acceptée

David K.
David K. le 18 Juil 2019
It seems like everything you've done so far is good. To merge two matrices you can use this simple command:
chirp = [Tx1 Tx2];
To check if they cover the same time you can type out, if it is 1 then they are the same length of time.
length(chirp) == length(0:Ts:2*T-Ts)
Hope this helps.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by