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

    %% Scalar Wideband Signal Propagating in Two-Ray Channel
% This example illustrates the two-ray propagation of a wideband signal, showing how
% the signals from the line-of-sight path and reflected path arrive at the receiver at different times.
%%
% *Note:* You can replace each call to the function with the equivalent
% |step| syntax. For example, replace |myObject(x)| with
% |step(myObject,x)|.

%% Create and Plot Transmitted Waveform
% Create a nonpolarized electromagnetic field consisting of two linear FM
% waveform pulses at a carrier frequency of 100 MHz. Assume the pulse width
% is 20 μs and the sampling rate is 10 MHz. The bandwidth of the pulse is
% 1 MHz. Assume a 50% duty cycle so that the pulse width is one-half
% the pulse repetition interval. Create a two-pulse wave train. Set the
% |GroundReflectionCoefficient| to –0.9 to model strong ground reflectivity.
% Propagate the field from a stationary source to a stationary receiver.
% The vertical separation of the source and receiver is approximately 10
% km.
c = physconst('LightSpeed');
fs = 10e6;
pw = 20e-6;
pri = 2*pw;
PRF = 1/pri;
fc = 100e6;
lambda = c/fc;
bw = 1e6;
waveform = phased.LinearFMWaveform('SampleRate',fs,'PulseWidth',pw,...
    'PRF',PRF,'OutputFormat','Pulses','NumPulses',2,'SweepBandwidth',bw,...
    'SweepDirection','Down','Envelope','Rectangular','SweepInterval',...
    'Positive');
wav = waveform();
n = size(wav,1);
plot([0:(n-1)]/fs*1e6,real(wav),'b')
xlabel('Time (\mu s)')
ylabel('Waveform Magnitude')

%% Specify the Location of Source and Receiver
% Place the source and receiver about 1 km apart horizontally and
% approximately 5 km apart vertically.
pos1 = [0;0;100];
pos2 = [1e3;0;5.0e3];
vel1 = [0;0;0];
vel2 = [0;0;0];

%% Create a Wideband Two-Ray Channel System Object
% Create a two-ray propagation channel System object(TM) and propagate the
% signal along both the line-of-sight and reflected ray paths. The same
% signal is propagated along both paths.
channel = phased.WidebandTwoRayChannel('SampleRate',fs,...
    'GroundReflectionCoefficient',-0.9,'OperatingFrequency',fc,...
    'CombinedRaysOutput',false);
prop_signal = channel([wav,wav],pos1,pos2,vel1,vel2);

[rng2,angs] = rangeangle(pos2,pos1,'two-ray');
%%
% Calculate time delays in μs.
tm = rng2/c*1e6;
disp(tm)
%%
% Display the calculated propagation paths azimuth and elevation angles in
% degrees.
disp(angs)

%% Plot the Propagated Signals
% 
% # Plot the real part of the signal propagated along the line-of-sight path.
% # Plot the real part of the signal propagated along the reflected path.
% # Plot the real part of the coherent sum of the two signals.
%%
% 

n = size(prop_signal,1);
delay = [0:(n-1)]/fs*1e6;
subplot(3,1,1)
plot(delay,real([prop_signal(:,1)]),'b')
grid
xlabel('Time (\mu sec)')
ylabel('Real Part')
title('Direct Path')

subplot(3,1,2)
plot(delay,real([prop_signal(:,2)]),'b')
grid
xlabel('Time (\mu sec)')
ylabel('Real Part')
title('Reflected Path')

subplot(3,1,3)
plot(delay,real([prop_signal(:,1) + prop_signal(:,2)]),'b')
grid
xlabel('Time (\mu sec)')
ylabel('Real Part')
title('Combined Paths')

%%
% The delay of the reflected path signal agrees with the predicted delay.
% The magnitude of the coherently combined signal is less than either of
% the propagated signals. This result indicates that the two signals
% contain some interference.