www.gusucode.com > phased 案例源码 matlab代码程序 > phased/PlotLFMWaveformExample.m
%% Plot LFM Waveform and Spectrum % Create and plot an upsweep linear FM pulse waveform. The sample rate is % 500 kHz, the sweep bandwidth is 200 kHz and the pulse width is 1 % millisecond (equal to the pulse repetition interval). fs = 500e3; sLFM = phased.LinearFMWaveform('SampleRate',fs,... 'SweepBandwidth',200e3,... 'PulseWidth',1e-3,'PRF',1e3); %% % Obtain and then plot the real part of the LFM waveform. lfmwav = step(sLFM); nsamp = size(lfmwav,1); t = [0:(nsamp-1)]/fs; plot(t*1000,real(lfmwav)) xlabel('Time (millisec)') ylabel('Amplitude') grid %% % Plot the Fourier transform of the complex signal. nfft = 2^nextpow2(nsamp); Z = fft(lfmwav,nfft); fr = [0:(nfft/2-1)]/nfft*fs; plot(fr/1000,abs(Z(1:nfft/2)),'.-') xlabel('Frequency (Hz)') ylabel('Amplitude') grid %% % Plot a spectrogram of the function with window size of 64 samples and 50% % overlap. nfft1 = 64; nov = floor(0.5*nfft1); spectrogram(lfmwav,hamming(nfft1),nov,nfft1,fs,'centered','yaxis') %% % This plot shows the increasing frequency of the signal.