📄 simcherr.m
字号:
function [sigOut,amperr,phaserr,quaderr] = simcherr(sigIn,am,ph,qu)% *****************************************************************************% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% function [sigOut,amperr,phaserr,quaderr] = simcherr(sigIn,am,ph,qu)%% Simulates channel errors in the form of amplitude errors, phase errors,% and quadrature errors.%% The output amplitude Aout for each sample is% Aout = (1+ Aerr)* Ain,% where Aerr is the uniformly distributed relative amplitude error and Ain is% the input amplitude.%%% sigOut (RxRadarSigT) : Radar signal after channel errors% amperr (RealVectorT) : A vector of simulated amplitude errors% phaserr (RealVectorT) : A vector of simulated phase errors% quaderr (RealVectorT) : A vector of simulated quadrature errors% sigIn (RxRadarSigT) : Radar signal before channel errors% am (RealScalarT) : Max amplitude error max((1+Aerr)) in dB.% ph (RealScalarT) : Max phase error in radians.% qu (RealScalarT) : Max quadrature error in dB.%%Known Bugs:% 1) The input parameter "phaserr" is not used in the code. A constant% "phaseerr" is used instead. Is this a typing error?% 2) There is no loop over different CPI:s or trials.%% Start : 9xxxxx Fredrik Athley (freath).% Latest change: $Date: 2000/10/16 15:21:52 $ $Author: svabj $.% $Revision: 1.12 $% *****************************************************************************%antenna = sigIn.antenna;XM = sigIn.signals;s = sizem(XM);noPulses = s(1);noRangeBins = s(2);noChannels = s(3);noNotUsed = s(4);noCPIs = s(5);noTrials = s(6);signals = zerosm(s);K = noChannels;amperr = (10^(am/20)-1)*(2*rand(1,K)-1);phaseerr = ph*(2*rand(1,K)-1);quaderr = (10^(qu/20)-1)*(2*rand(1,K)-1);errvec = (1+amperr).*exp(i*phaseerr);for trialLoop = 1:noTrialsfor cpiLoop = 1:noCPIsfor notUsedLoop = 1:noNotUsedfor rangeLoop=1:noRangeBins % ------------ Get signals. ------------ X = getm(XM, ':',rangeLoop,':',notUsedLoop,cpiLoop,trialLoop).'; [r,c] = size(X); if r~=noChannels X = X.'; end % % ------------ Apply amplitude and phase errors. ------------ X = full(sparse(diag(errvec))*X); % ------------ Simulate I/Q-errors. ------------ Xim = imag(X); Xre = real(X); Xim = full(sparse(diag(1+quaderr))*Xim); X = Xre + i*Xim; % ------------ Save signals. ------------ %signals = setm(signals, X.', ':',rangeLoop,':', ... % notUsedLoop,cpiLoop,trialLoop); signals(':',rangeLoop,':',notUsedLoop,cpiLoop,trialLoop) = X.';end%for rangeLoopend%for notUsedLoopend%for cpiLoopend%for trialLoopsigOut = sigIn; % Must copy all information in the input signal.sigOut.signals = signals; % Modify part of the input signal.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -