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

    %% Coherent-on-Receive for Rectangular Pulse
% To illustrate coherent-on-receive, construct a rectangular pulse waveform
% with five pulses. The waveform pulse repetition frequency (PRF) is 10 kHz
% and the pulse width is 50 μs. The pulse repetition interval (PRI) is
% exactly two times the pulse width so the transmitter alternates between
% active and inactive time intervals of the same duration. For convenience,
% set the gains on both the transmitter and receiver to 0 dB and the peak
% power on the transmitter to 1 W.
%%
% Use the |PhaseNoiseOutputPort| and |InUseOutputPort| properties of the
% transmitter to record the phase noise and the status of the transmitter.
%%
% Enable the |EnableInputPort| and |PhaseNoiseInputPort| properties of the
% receiver preamp to determine when the receiver is active and to correct
% for the phase noise introduced at the transmitter.
%%
% Delay the output of the transmitter using the 
% |delayseq| function to simulate the waveform arriving
% at the receiver preamp when the transmitter is inactive and the receiver
% is active.
%%
% *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.RectangularWaveform('NumPulses',5);
transmitter = phased.Transmitter('CoherentOnTransmit',false,...
    'PhaseNoiseOutputPort',true,'Gain',0,'PeakPower',1,...
    'SeedSource','Property','Seed',1000,'InUseOutputPort',true);
wf = waveform();
[troutput,trstatus,phasenoise] = transmitter(wf);
troutput = delayseq(troutput,waveform.PulseWidth,...
    waveform.SampleRate);
receiver = phased.ReceiverPreamp('Gain',0,...
    'PhaseNoiseInputPort',true,'EnableInputPort',true);
y = receiver(troutput,~trstatus,phasenoise);
subplot(2,1,1)
plot(real(troutput))
title('Delayed Transmitter Output with Phase Noise')
ylabel('Amplitude')
subplot(2,1,2)
plot(real(y))
xlabel('Samples')
ylabel('Amplitude')
title('Received Signal with Phase Correction')