📄 expsig1.m
字号:
function sigvar = expsig1(antenna, signalFileName, measIndex, snapshots, dbName, measName, pModulation)%EXPSIG1 Reads antenna signals measured with the AIMT experimental antenna.%%--------%Synopsis:% sigvar = expsig1(antenna, signalFileName, measIndex, snapshots)% sigvar = expsig1(antenna, signalFileName, measIndex, snapshots, dbName,% measName, pModulation)%%Description:% Reads antenna signals measured with the AIMT experimental antenna [2].% Can read signals both from passive (listen-only mode) and active mode% (radar mode) [3].%% Signals in passive and active are stored and interpreted differently. % In passive mode the subscripts are (timeIx, 1, channelIx, extraIx, 1, % trialIx). In active mode the subscripts are (pulseIx, timeInPulseIx, % channelIx, extraIx, cpiIx, trialIx). See [1] for more information.%% In passive mode several meaurements can be stored in the trialIx% dimension. In active mode this is not possible. In active mode there% can be several pulses and alla pulses are read at once. % Several pulses is not possible in passive mode.% % The signals must have been down-converted with a factor 4 if this% function is to be used.%%Output and Input:% sigvar (RxRadarSigT): The read signals.% antenna (AntDefT): The used antenna definition. It must be of antenna% type 'expAnt'. See function "defant".% signalFileName (StringT): Name of file which contains measured signals.% It normally ends with ".dbs".% measIndex [D](IndexT): Chooses which (1.. max) of several measurement% in the signal file to use. Several measurements can be specified, in% which case they are stored as different trials (trialIx) in the output % signal. Default is to use the first measurement only.% "measIndex" cannot be used for measurements in active mode (radar mode).% snapshots [D](IndexT): Which snapshots to use. This input variable allows% for dividing long signals into shorter ones. The available range of% snapshots is equal to the number of rows of the matrix "vfilt", seen% by "matwhos file.dbs", where "file.dbs" is the antenna signal file.% dbName [D](StringT): Name of measurement database including full search path.% Not implemented.% measName [D](StringT): Name of measurement. Not implemented.% pModulation (CxVectorT): The complex coefficients for the modulation% code (see function "getmod"). For radar measurements this parameter% should be specified if pulse compression etc. is to work. For passive% mode, this input parameter is not needed.%%Global Variables:% c0 (RealScalarT) [from defant]: The speed of light in vacuum.%%--------%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:% ant = defant('expAnt');% setcal1('wctab','dbtex.dbc')% sig = expsig1(ant,'dbtex.dbs',1, 65:128);% R = ecorrm(sig);% spect2 = sdoaspc('capon',R,d2r(-30:0.25:30));% spect3 = sdoaspc('cbf',sig,d2r(-30:0.25:30));% splot2(spect2, '',spect3)% pdoapar(sdoapar1('dml',sig, doaStart))%%Software Quality:% (About what is done to ascertain software quality. What tests are done.)% This function with dbs-files of version 2 was used in the work done by% A. Heydarkhan [4].%%Known Bugs:% If the input parameter "pModulation" is not specified for radar measurements,% no pulse modulation is stored in the output signal. This information can% be acquired from the measurement database but currently not from the DBS % file. If performing for example pulse compression on the output signal, % the field "sigvar.waveform.pModulation" in the output signal "sigvar"% must first be set manually. This must also be done if a modulation different% from the transmitted, e.g. a measured, is to be used for pulse compression % etc.%%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]: Pettersson L., Danestig M., Sj鰏tr鰉 U.: "An Experimental S-Band% Digital Beamforming Antenna", IEEE AES Systems Magazine, November 1997,% p.19-26.% [3]: Bj鰎klund S.:"A MATLAB Toolbox for Radar Signal Processing",% Proceedings of Nordic MATLAB Conference `97, Stockholm 27-28 October 1997.% [4]: Heydarkhan A.: "Model Based Direction of Arrival Estimation Methods% Applied to Experimental Antenna Data", Master's Thesis, Chalmers% University of Technology 1997. FOA-R--97-00631-408--SE, FOA November 1997.%%See Also:% defant, setcal1, compsim2, ecorrm, doaspc1, doapar1, dbtex7% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.% Start : 970609 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/11/17 12:45:24 $ $Author: svabj $.% $Revision: 1.37 $% *****************************************************************************% ----------------------------------------------------------------------- %% Handle input parameters.% ----------------------------------------------------------------------- %if (nargin < 2) dbterror('To few input parameters.')end% ****************** Add missing input parameters ******************if (nargin < 3) measIndex = [];endif (nargin < 4) snapshots = [];endif (nargin < 5) dbName = [];endif (nargin < 6) measName = [];endif (nargin < 7) pModulation = [];end% ****************** Default values ******************if isempty(measIndex) measIndex = 1;end%ifif isempty(snapshots) %This is done below.end%ifif isempty(pModulation) pModulation = []; % What should it be? Is the modulation known? % Can it be fetched from the DBS file?end%if% ****************** Error check input parameters ******************chkdtype(antenna, 'AntDefT')chkdtype(signalFileName, 'StringT')chkdtype(measIndex, 'IntScalarT','IndexT')chkdtype(snapshots, 'IndexT','EmptyT')chkdtype(pModulation, 'CxVectorT','EmptyT')% ****************** Pick out fields from input parameters. ******************% ----------------------------------------------------------------------- %% Do the work.% ----------------------------------------------------------------------- %if ~isfield(antenna,'name') dbterror('Not implemented for the specified antenna type.')else if ~(strcmp(antenna.name,'expAnt')) dbterror('Not implemented for the specified antenna type.') else extraIx = []; cpiIx = []; trialIx = []; global c0 % From defant. exp2dbtversion = matgetm(signalFileName,'exp2dbtversion'); %fprintf('expsig1:exp2dbtversion=%d\n',exp2dbtversion) if (exp2dbtversion >= 3) Ipri = matgetm(signalFileName,'Ipri'); else Ipri = 1; end; noPri = length(Ipri); % The words "PRI" and "pulse" are the same. vfilt = matgetm(signalFileName,'vfilt'); if isempty(snapshots) snapshots = (1:size(vfilt,1)); end%if noSnapshots = length(snapshots); noElem = antenna.noElem; fRFMHz = matgetm(signalFileName,'fRFMHz'); % Carrier frequency. fsigMHz = matgetm(signalFileName,'fsigMHz'); % Signal frequency. lambda = c0/((fRFMHz+fsigMHz)*1e6); % The right value of the wavelength. downConversion = 4; sampleTime = downConversion/(25.8e6); % ------------------------------------------------------------------- % % Passive mode. % ------------------------------------------------------------------- % if (noPri == 1) if ~((exp2dbtversion == 2) | (exp2dbtversion == 3)) dbterror('Wrong version of the file ',signalFileName) else noMeasIx = length(measIndex); signals = zerosm([noSnapshots 1 noElem 1 1 noMeasIx]); % Only one range bin and CPI in passive mode. for trialIxLoop = 1:noMeasIx oneMeasIndex = measIndex(trialIxLoop); X = (vfilt(snapshots,(oneMeasIndex-1)*noElem + [1:noElem])).'; % X(m,n), where m is index for elements and n index for snapshots . signals = setm(signals, X.', ':',1,':',1,1, trialIxLoop); dbtloopinfo('expsig1', [], ':', noSnapshots, 1, 1, ':',noElem, ... 1, 1, 1, 1,trialIxLoop, noMeasIx) end%for trialIxLoop dbtinfo(''); %New line. waveform = defwave(lambda,1,noSnapshots,[],sampleTime); pulIx = 1:noSnapshots; ranIx = 1; spaIx = 1:noElem; trialIx = measIndex; end%if exp2dbtversion % ------------------------------------------------------------------- % % Active mode. % ------------------------------------------------------------------- % else % (noPri > 1) if ~(exp2dbtversion == 3) dbterror('Wrong version of the file ',signalFileName) else if (measIndex ~= 1) dbterror('Index <> 1 cannot be used in active mode.') end%if if isempty(pModulation) dbterror(['The input parameter "pModulation" must be specified ',... 'in active (radar) mode.']) end%if signals = zerosm([noPri noSnapshots noElem 1 1]); % Only one trial is implemented. for npri = Ipri % Loop over all values in the vector Ipri. % X = (vfilt(snapshots,(npri-1)*noElem + [1:noElem])).'; signals(npri,':',':',1,1) = (vfilt(snapshots,(npri-1)*noElem + ... noPri*(measIndex-1) + [1:noElem])); % X(m,n), where m is index for elements and n index for snapshots . %--signals = setm(signals, X.', npri,':',':',1,1); %signals(npri,':',':',1,1) = X.'; % setm % Test of change to Matlab 5 indexing instead of setm: %>> all(all(all((sig.signals == sig12.signals),1),2),3) % ans = % 1 infoStr = sprintf('expsig1: npri = %d(%d)\r',npri,length(Ipri)); dbtinfo(infoStr,1); end%for npri dbtinfo(''); %New line if (~isempty(dbName) & (~isempty(measName))) disp('Reading measurement information from measurement database...') angedb(dbName) angemat(measName) noRangeBinsTot = round(mparam('Kpri') * (1/3.225e6)/sampleTime); % Is this correct? The intended in defwave? else noRangeBinsTot = noSnapshots; % Better than nothing. end%if waveform = defwave(lambda,noRangeBinsTot,noPri,pModulation,sampleTime); pulIx = 1:noPri; ranIx = 1:noSnapshots; spaIx = 1:noElem; end%if exp2dbtversion end%if noPri % ------------------------------------------------------------------- % % Finnish. Create ouput variable. % ------------------------------------------------------------------- % sigvar = RxRadarSigT(signals,{antenna,waveform},[], pulIx,ranIx,spaIx, ... extraIx,cpiIx,trialIx); end%if expAntend%if name
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -