www.gusucode.com > phased 案例源码 matlab代码程序 > phased/DoubleTriangularSweepExample.m

    %% Double Triangular Sweep
% This example shows how to sample an FMCW waveform with a double
% triangular sweep in which the two sweeps have different slopes. Then,
% the example plots a spectrogram.
%%
% *Note:* This example runs only in R2016b or later. If you are using an earlier
% release, replace each call to the function with the equivalent |step|
% syntax. For example, replace |myObject(x)| with |step(myObject,x)|.
%%
% Create an FMCW waveform object for which the |SweepTime| and
% |SweepBandwidth| properties are vectors of length two. For each period,
% the waveform alternates between the pairs of corresponding sweep time and
% bandwidth values.
st = [1e-3 1.1e-3];
bw = [1e5 9e4];
waveform = phased.FMCWWaveform('SweepTime',st,...
    'SweepBandwidth',bw,'SweepDirection','Triangle',...
    'SweepInterval','Symmetric','SampleRate',2e5,...
    'NumSweeps',4);
%%
% Compute samples from four sweeps (two periods). In a triangular sweep,
% each period consists of an up sweep and down sweep.
x = waveform();
%%
% Plot the spectrogram.
[S,F,T] = spectrogram(x,32,16,32,waveform.SampleRate);
image(T,fftshift(F),fftshift(mag2db(abs(S))))
xlabel('Time (sec)')
ylabel('Frequency (Hz)')