www.gusucode.com > phased 案例源码 matlab代码程序 > phased/CreatePlotSteppedFMPulseWaveformExample.m
%% Create and Plot Stepped FM Pulse Waveform % This example shows how to create and plot a 5-step Stepped FM pulse % waveform. Set the pulse width (duration) to 50 μs, the pulse repetition % frequency (PRF) to 10 kHz, and the frequency step to 20 kHz. The % sampling rate is 1 MHz. By default the |OutputFormat| % property is set to |'Pulses'| and the number of pulses % in the output is set to one. %% % *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)|. waveform = phased.SteppedFMWaveform('SampleRate',1e6,... 'PulseWidth',50e-6,'PRF',10e3,... 'FrequencyStep',20e3,'NumSteps',5); %% % Use the |bandwidth| function to show that the bandwidth of the stepped FM % pulse waveform is the product of the frequency step and the number of % steps. bandwidth(waveform) %% % Because the |OutputFormat| property is set to 'Pulses' and the % |NumPulses| property is set to one, executing the System object(TM) % returns one pulse repetition interval (PRI). The pulse duration within % that interval is set by the |PulseWidth| property. The remainder of the % PRI consists of zeros. %% % The frequency of the initial pulse is zero Hz (DC). With the |NumPulses| % property set to one, each time you execute the System object(TM), the % frequency of the narrowband pulse increments by the value of the % |FrequencyStep| property. If you execute the System object more times % than the value of the |NumSteps| property, the process repeats, starting % over with the DC pulse. %% % Execute the System object to return successively higher frequency pulses. % Plot the pulses one by one in the same figure window. Pause the loop to % visualize the increment in frequency with each execution of the System % object. Execute the System obkect one more time than the number of pulses % to demonstrate that the process starts over with the DC pulse. %% % This figure shows the pulse plot for the last iteration of the loop. t = unigrid(0,1/waveform.SampleRate,1/waveform.PRF,'[)'); for i = 1:waveform.NumSteps plot(t,real(waveform())) pause(0.5) axis tight end %% % This plot shows how the pulse returns to its DC value. plot(t,waveform())