📄 compsim4.m
字号:
function [sigvar, tgtSig] = compsim4(antenna, waveform, noSamp, tgtType, tgtParam, noiseType, noiseParam, clutterType, clutterParam)%COMPSIM4 Simulates received antenna signals in passive mode.%%--------%Synopsis:% compsim4(antenna, waveform, noSamp, tgtType, tgtParam, noiseType,% noiseParam)% [sigvar, tgtSig] = compsim4(antenna, waveform, noSamp, tgtType,% tgtParam, noiseType, noiseParam)%% compsim4(antenna, lambda, noSamp, tgtType, tgtParam, noiseType,% noiseParam)% [sigvar, tgtSig] = compsim4(antenna, lambda, noSamp, tgtType,% tgtParam, noiseType, noiseParam)%%Output and Input:% sigvar (RxRadarSigT): Simulated radar signal.% tgtSig (CxMatrixT): The simulated target signal in a% (noOfTargets x noOfSnapshots) matrix.% antenna (AntDefT): Antenna definition for the receiver.% waveform (WaveformT): Waveform, including wavelength,% number of range bins, number of pulses, modulation within a pulse etc.% lambda (RealScalarT): The wavelength (lambda) [m].% noSamp (IntScalarT): Number of snapshots.% tgtType (StringT): Target type, se below.% tgtParam: Type and contents depends on tgtType, see below.% noiseType (StringT): Noise type, se below.% noiseParam: Type and contents depends on noiseType, see below.% clutterType (StringT): Clutter type, se below.% clutterParam: Type and contents depends on clutterType, see below.%%Description% Simulates received antenna signals in passive mode (listen only).% The target and noise signals are summed to form the output signal.% Possible target signals are random signals with a complex gaussian% distribution and an arbitrary source-to-source correlation matrix% or constant signals with Doppler shifts or no target signal at all.% Possible noise signals are complex gaussian noise with arbitrary% spatial correlation matrix or no noise signal at all.% There is no range information, i.e. there is only one range bin.%% In this function the term "signal-to-noise ratio" means the ratio of signal% power to noise power for each targets signal, each channel and each time% snapshot. The signal-to-noise ratio is not allways easy to determine.% If tgtType = 'const' or 'rndnw', the received target signals are% created with a signal-to-noise ratio related to a one-variance noise% using the SNR input parameter. If tgtType = 'rndn' then the power of% the targets signals are given by the source correlation matrix tgtCorrMat.% In this case the SNR input parameter is not used. Then, if noiseType% = rndnw, noise with variance one is added. If noiseType = rndn, a noise% is added, whose power is given by the noise correlation matrix noiseParam.%% If the noise power is 1 and the signal power is the value of the input% parameter SNR, the formula X=A*B gives the expected signal-to-noise ratio% (=SNR) only if the the absolute value of all elements in A is 1. This% may be true for an ULA with isotropical elements but it is not true in% general.%% This complicated description means that the resulting signal-to-noise% ratio not allways is the same as the SNR input parameter. Only when% tgtType = 'const' or 'rndnw' and noiseType = rndnw and absolute value% of all elements in A is 1, the SNR input parameter is equal to the% signal-to-noise ratio.%% The targets signals generated by this function corresponds to Swerling% cases 1,3 and 5 ([2] p. 95-99, [3] p. 65-67) in radar theory. Maybe% this is applicable only for tgtType = 'const' (constant target signals% with doppler shift) and not for random signals.% Swerling cases 1,3 and 5 means that the amplitude of the signal is% unchanged between adjacent snapshots (pulses) but can change between% different trials (CPI:s, coherent processing intervalls). Currently% this function only can generate signals for one trial. % Swerling% case 1 means that the amplitude exhibits large fluctuations% between different CPI:s. Swerling case 3 means that the amplitude% exhibits small fluctuations between different CPI:s. Swerling case 5% (also called Swerling case 0 or Marcum case) means that the amplitude% does not fluctuate between different CPI:s. It is possible to simulate% Swerling cases 1,3 and 5 with this function by calling it once for each% CPI and letting yhe SNR input parameter be a random variable with suitable% probability distristribution, see [2,3].%%--------%Target signals% tgtType = 'const': Constant source signals.% tgtParam Matrix = [theta, phi, SNR, alpha, dalpha, dist]% (Name) (Data Type) (Description)% theta (RealVectorT): Target directions (radians).% phi (RealVectorT): Target directions (radians). Unused.% SNR (RealVectorT): Target SNR:s measured per channel and snapshot% after the receiver and A/D-converter. Se "Description" above for% description of signal-to-noise ratio.% alpha (RealVectorT): Target start phases.% dalpha (RealVectorT): Target phase shifts (doppler shifts).% dist (RealVectorT): Target distances.% The parameter tgtCorrMat is unused.% tgtType ='rndnw' : Complex gaussian random source signals. Uncorrelated% between targets and in time.% tgtParam Matrix = [theta, phi, SNR, alpha, dalpha, dist]% Parameters theta, phi, SNR, dalpha, dist as for 'const'.% The other parameters are unused.% tgtType ='rndn': Complex gaussian random source signals.% tgtParam Matrix = [theta, phi, SNR, alpha, dalpha, dist, tgtCorrMat]% tgtCorrMat (CxMatrixT): Source correlation matrix.% Parameters theta, phi, dalpha, dist as for 'const'.% The other parameters are unused. Note especially that SNR is not used% but tgtCorrMat.% tgtType ='notgt': No target signals.%%--------%Noise signals% noiseType = 'rndnw': Complex gaussian noise. Uncorrelated between channels% and in time.% noiseType = 'rndn': Complex gaussian noise.% noiseParam (CxMatrixT): Noise correlation matrix.% noiseType = 'nonoise': No noise.%%--------%Notations:% Data type names are shown in parentheses and they start with a capital% letter and end with a capital T. Data type definitions can be found in [1]% or by "help dbtdata".% [D] = This parameter can be omitted and then a default value is used.% When the [D]-input parameter is not the last used in the call, it must be% given the value [], i.e. an empty matrix.% ... = There can be more parameters. They are explained under respective% metod or choice.%%Examples:%Algoritm:%Software Quality% (About what is done to ascertain software quality. What tests are done.)%%Known Bugs:% Not all possible input parameters of the function "spastemat" is used;% pointing directions of subarray and antenna errors are not specified.%%References:% [1]: Bj鰎klund S.: "DBT, A MATLAB Toolbox for Radar Signal Processing.% Reference Guide", FOA-D--9x-00xxx-408--SE, To be published.% [2]: Kingsley S., Quegan S.: "Understanding Radar Systems",% McGraw-Hill 1992. ISBN 0-07-707426-2.% [3]: Sume A.: "Kursmaterial i radarteori", FOA 1995, FOA-D--95-00108-3.3--SE.%%See Also:% compsim5, expsig1, ecorrm, simcherr, doaspc1, doapar1, dbthelp, dbtex1% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 951220 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:20:12 $ $Author: svabj $.% $Revision: 1.11 $% *****************************************************************************% Sample time also as input parameter!?! Waveform or PRI also ?% This function only manage PRI = T (= Sampling interval). This means that% there is only one range bin. <- ???% noTrials (IntScalarT): Number of trials. Not implemented.% ----------------------------------------------------------------------- %% Pick out fields from input parameters.% ----------------------------------------------------------------------- %chkdtype(antenna, 'AntDefT')chkdtype(noSamp, 'IntScalarT')chkdtype(tgtType, 'StringT')chkdtype(noiseType, 'StringT')noElem = antenna.noElem;if (isstruct(waveform)) lambda = waveform.wavelength;else % Allows a simplified call. lambda = waveform;end%ifT = noSamp;M = size(tgtParam,1); % Number of targets.theta = tgtParam(:,1); % Target directions (radians).%phi = tgtParam(:,2); % Target directions (radians).SNR = tgtParam(:,3); % SNR for each target.alpha = tgtParam(:,4); % Phase at the first antenna % element for each target.dalpha = tgtParam(:,5); % Phase increment for each % target (doppler shift).dist = tgtParam(:,6);if (size(tgtParam,2) > 6) tgtCorrMat = tgtParam(:,7:(7-1+size(tgtParam,1)));end% ----------------------------------------------------------------------- %% Return the current seed of normal generator and set it to different values% each time.% ----------------------------------------------------------------------- %randn('seed',sum(100*clock));rand('seed',sum(100*clock));% ----------------------------------------------------------------------- %% Simulate the signals. Preliminary testings.% ----------------------------------------------------------------------- %if (nargin > 7) error('DBT-Error: Clutter is not implemented.')end%if% ----------------------------------------------------------------------- %% Simulate the TARGET signals.% ----------------------------------------------------------------------- %% B(m,n) 鋜 en matris med amplitud och fas hos m錶signalerna vid ena 鋘den% av gruppantennen.% m 鋜 m錶index och n tidsindex. (m 鋜 radindex och n kolumnindex i matrisen)% ----------------------------------------------------------------------- %% Bilda en m錶signalmatris.M = size(theta,1); % Antal m錶.if (strcmp(tgtType,'const')) % The noise power is assumed to be 1. The power of each targets signal % is therefore equal to the value given by the input parameter SNR. % This means that the amplitude of the signals should be 10.^(SNR./20). B= (10.^(SNR./20).*exp(j*alpha))*ones(1,T);elseif (strcmp(tgtType,'rndnw')) % The noise power is assumed to be 1. The power of each targets signal % is therefore equal to the value given by the input parameter SNR. sigmab = sqrt(0.5)*(10.^(SNR./20))*ones(1,T); % Source standard deviation. B = sigmab.*(randn(M,T) + j*randn(M,T));elseif (strcmp(tgtType,'rndn')) % This part is from the FOA SASP course 96. if (size(tgtCorrMat,2) < size(tgtParam,1)) error('DBT-Error: Missing source correlation matrix.') end [U,S,V] = svd(tgtCorrMat); B=(1/sqrt(2))*U*sqrt(S)*(randn(M,T) + j*randn(M,T));elseif (strcmp(tgtType,'notgt')) B=0;else error('DBT-Error: The source model does not exist.')end%if% Ordna konstant fasskift mellan tidssamplena.% Simulates dopples shift due to movement.B= B.*exp(j*dalpha*(0:(T-1)));% ----------------------------------------------------------------------- %% Simulate the NOISE-signals.% ----------------------------------------------------------------------- %% Nt(m,n) inneh錶ler komplext brus. m 鋜 antennelementindex. n 鋜 tidsindex.% ----------------------------------------------------------------------- %if (strcmp(noiseType,'rndnw')) sigman = sqrt(0.5); % Noise standard deviation for the real part and for the imaginary % part. The total power of the noise is 0.5 + 0.5 (real + imaginary) = 1. Nt = sigman*(randn(noElem,T) + j*randn(noElem,T));elseif (strcmp(noiseType,'rndn')) M = size(theta,1); % Compute the square root of the source covariance matrix with SVD [U,SIG,V] = svd(noiseParam); % Generate i.i.d random variables with variance two. n = randn(noElem,T) + i*randn(noElem,T); % Color the i.i.d random variables with the square root of the % noise covariance matrix. Nt = 1/sqrt(2)*U*sqrt(SIG)*n;elseif (strcmp(noiseType,'nonoise')) Nt=0;else error('DBT-Error: The noise model does not exist.')end%if% ----------------------------------------------------------------------- %% Compose the simulated signals.% ----------------------------------------------------------------------- %% Mottagna signaler fr錸 antennelementen.% X(m,n) inneh錶ler mottagna signaler fr錸 antennelementen.% m 鋜 antennelementindex. n 鋜 tidsindex.% ----------------------------------------------------------------------- %A = spastemat(antenna, theta', lambda, dist); % Not all input parameters of spastemat is used. % Pointing directions of subarray and antenna errors are not specified. % This is an error.X=A*B; % If the noise power is 1 and the signal power is the value of the input % parameter SNR, the formula X=A*B gives the expected signal-to-noise ratio % (=SNR) only if the the absolute value of all elements in A is 1. This % may be true for an ULA with isotropical elements but it is not true in % general.if (~all(all(abs(abs(A) - 1) < eps))) disp('Warning: In compsim4, the absolute value of some elements in A is not 1.'); disp('This means that the signal-to-noise ratio may not be the expected.');endX=X+Nt;% ----------------------------------------------------------------------- %% Return data.% ----------------------------------------------------------------------- %signals = zerosm([size(X,2) 1 size(X,1) 1 1]); % Only one trial is implemented.signals = setm(signals, X.', ':',1,':',1,1);if (~(isstruct(waveform))) waveform = defwave(lambda,1,noSamp,[],[]);end%ifnew = 1;if (new) sigvar = RxRadarSigT(signals, {antenna, waveform});else sigvar.dataType = 'RxRadarSigT'; sigvar.signals = signals; sigvar.antenna = antenna; sigvar.waveform = waveform;end%iftgtSig = B;% End Of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -