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

    %% Propagate Signal to Multiple Destinations
% Create a FreeSpace System object to propagate a signal from one point to
% multiple points in space. Start by defining a signal origin and three
% destination points, all at different ranges.

% Copyright 2015 The MathWorks, Inc.


%%
% Compute the propagation direction angles from the source to the destination
% locations. The source and destination are stationary.
pos1 = [0,0,0]';
vel1 = [0,0,0]';
pos2 = [[700;700;100],[1400;1400;200],2*[2100;2100;400]];
vel2 = zeros(size(pos2));
[rngs,radiatingAngles] = rangeangle(pos2,pos1);

%%
% Create the cosine antenna element, ULA array, and Radiator System
% objects.
fs = 8000;
freq = 300e6;
nsensors = 4;
sAnt = phased.CosineAntennaElement;
sArray = phased.ULA('Element',sAnt,'NumElements',nsensors);
sRad = phased.Radiator('Sensor',sArray,...
    'OperatingFrequency',freq,...
    'CombineRadiatedSignals',true,'WeightsInputPort',true);
%%
% Create a signal to be one cycle of a sinusoid of amplitude one and having a frequency of 4 kHz.
fsig = 4000;
t = [0:0.01:2]'/fs;
signal = sin(2*pi*fsig*t);
%%
% Radiate the signals in the destination directions. Apply a uniform
% weighting to the array.
y = step(sRad,signal,radiatingAngles,[1,1,1,1].');
%%
% Propagate the signals to the destination points.
sFSp = phased.FreeSpace('OperatingFrequency',freq,'SampleRate',fs);
yprop = step(sFSp,y,pos1,pos2,vel1,vel2);

%%
% Plot the propagated signal magnitudes for each range.
figure
plot(1000*t,abs(yprop(:,1)),1000*t,abs(yprop(:,2)),1000*t,abs(yprop(:,3)))
ylabel('Signal Magnitude')
xlabel('Time (millisec)')