www.gusucode.com > phased 案例源码 matlab代码程序 > phased/CompareAutocorrelationForRectangularAndLinearFMWaveformsExample.m
%% Compare Autocorrelation for Rectangular and Linear FM Waveforms % This example shows how to compute and plot the ambiguity function % magnitudes for a rectangular and linear FM pulse waveform. The zero % Doppler cut (magnitudes of the autocorrelation sequences) illustrates % pulse compression in the linear FM pulse waveform. %% % *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 a rectangular waveform and a linear FM pulse waveform having the % same duration and PRF. Generate samples of each waveform. rectwaveform = phased.RectangularWaveform('PRF',20e3); lfmwaveform = phased.LinearFMWaveform('PRF',20e3); xrect = rectwaveform(); xlfm = lfmwaveform(); %% % Compute the ambiguity function magnitudes for each waveform. [ambrect,delay] = ambgfun(xrect,rectwaveform.SampleRate,rectwaveform.PRF,... 'Cut','Doppler'); ambfm = ambgfun(xlfm,lfmwaveform.SampleRate,lfmwaveform.PRF,... 'Cut','Doppler'); %% % Plot the ambiguity function magnitudes. subplot(211) stem(delay,ambrect) title('Autocorrelation of Rectangular Pulse') axis([-5e-5 5e-5 0 1]) set(gca,'XTick',1e-5*(-5:5)) subplot(212) stem(delay,ambfm) xlabel('Delay (seconds)') title('Autocorrelation of Linear FM Pulse') axis([-5e-5 5e-5 0 1]) set(gca,'XTick',1e-5*(-5:5))