📄 wideex3.m
字号:
function [estDoaAllOut, meanDoa, stdDoa, realNoSrc, spec, noTrials, relBW,elapTime] = wideex3(xScaleType)%WIDEEX3 Monte Carlo simulations and statistical analysis with simulated wideband signals.%%% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 981230 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:39:38 $ $Author: svabj $.% $Revision: 1.9 $% *****************************************************************************disp('Monte Carlo simualtions and statistical analysis with wideband signals.')eeTimeVar = eetimebegin; % Start estimation of execution time.if (nargin < 1) xScaleType = 'lin';end%if% ----------------------------------------------------------------------- %% Parameters.% ----------------------------------------------------------------------- %SNR = 5;%noTrials = 100noTrials = 10%noRelBW = 10noRelBW = 5relBWStart = 1e-3;relBWSlut = 2-eps;if (strcmp(xScaleType,'log')) relBW = logspace(log10(relBWStart),log10(relBWSlut),noRelBW) % Relative bandwidth.else relBW = linspace(relBWStart,relBWSlut,noRelBW) % Relative bandwidth.end%ifbeampos = d2r([-6:3:6]); % Do conventional beamforming in these direction.doaPos = d2r([20:0.001:40]); % Calculate spectrum in theese direction for 'amir' tec.rangePos = 13;dopplerPos = 72; % The targets are located in this doppler channel. This is aproximatelly a doppler frequency of 470 Hz.% ----------------------------------------------------------------------- %% Definition of the receiver antenna.% ----------------------------------------------------------------------- %lambda = 0.1; % wavelength.D = 0.45*lambda; % Element separation.K = 12; % Number of digital antenna channels.antenna = defant('isotropULA',[K,D]); % Define the antenna.% ----------------------------------------------------------------------- %% Definition of the sources.% ----------------------------------------------------------------------- %propSpeed = speedoflight; % [m/s].carrierFreq = propSpeed / lambda; % [Hz]. (3 GHz)noTimes = 32;srcSignals = [];noSrc = 2;theta = d2r([25 32]).'; % Target angles. The number of targets is % given by the number of target angles.srcDoas = theta.';srcPowers = ones(noSrc,1)srcCorr = [];orthSig = [];noiseType = 'randn';noisePower = srcPowers(1) / (10^(SNR/10))realNoSrc = size(theta,1);% ----------------------------------------------------------------------- %% Simulation of constant signals.% ----------------------------------------------------------------------- %noMethods = 6;noBW = length(relBW);estDoaAll = zeros(noTrials,noMethods,noBW, realNoSrc);meanDoa = zeros(noBW,noMethods,realNoSrc);stdDoa = zeros(noBW,noMethods,realNoSrc);spec = cell(noBW);figureeeTimeVar = eetimepreloop(eeTimeVar, noTrials, noBW); % Prepare for execution time information.for relBWLoop = 1:noBW for trialLoop =1:noTrials % ----------------------------------------------------------------------- % % Simulation of signals. % ----------------------------------------------------------------------- % bandwidth = relBW(relBWLoop) * carrierFreq; % [Hz]. %sig = simwidebandkernel('randn',antenna,carrierFreq, bandwidth, ... % noTimes, [], srcSignals, srcDoas, srcPowers, {srcCorr}, ... % orthSig, propSpeed, [], noiseType, noisePower); sig = simwidebandkernel(antenna, [], carrierFreq, bandwidth, noTimes, ... [], propSpeed, 'randn', srcSignals, srcPowers, srcDoas, [], ... {srcCorr}, [], noiseType, noisePower); % , [], orthSig, [], 17 if (trialLoop == 1) spect1 = sdoaspc('music',sig,doaPos,noSrc); % Estimate the DOA-spectrum with MUSIC. splot2(spect1) plotxline(r2d(theta),'m','--') drawnow spec{relBWLoop} = spect1; end%if R = ecorrm(sig); doaStart = theta(:).'; estDoa1 = sdoapar1('dml',R,doaStart); estDoa2 = sdoapar1('sml',R,doaStart); estDoa3 = sdoapar1('wsf',R,doaStart); estDoa4 = sdoapar1('ssf',R,doaStart); estDoa5 = sdoapar1('rmusic',R,noSrc); estDoa6 = sdoapar1('esprit',R,noSrc); estDoaAll(trialLoop,1,relBWLoop,:) = estDoa1; estDoaAll(trialLoop,2,relBWLoop,:) = estDoa2; estDoaAll(trialLoop,3,relBWLoop,:) = estDoa3; estDoaAll(trialLoop,4,relBWLoop,:) = estDoa4; estDoaAll(trialLoop,5,relBWLoop,:) = estDoa5; estDoaAll(trialLoop,6,relBWLoop,:) = estDoa6; eeTimeVar= eetimeloop(eeTimeVar, [], trialLoop, relBWLoop, 'relBWL'); % Display execution time information. end%for trialLoop statDim = 1; % Dimension to analyze statistical. fprintf('\n') fprintf('Relative bandwidth = %d.\n',relBW(relBWLoop)) %fprintf('\nMean of estimated DOA.\n') %meanDoa(relBWLoop,:) = mean(squeeze(estDoaAll(:,:,relBWLoop,:))); meanDoa(relBWLoop,:,:) = squeeze(mean(estDoaAll(:,:,relBWLoop,:),statDim)); %r2d(meanDoa(relBWLoop,:)) %fprintf('\nStandard deviation of estimated DOA.\n') stdFlag = 0; %stdDoa(relBWLoop,:) = std(squeeze(estDoaAll(:,:,relBWLoop))); stdDoa(relBWLoop,:,:) = squeeze(std(estDoaAll(:,:,relBWLoop,:), ... stdFlag, statDim)); %r2d(stdDoa(relBWLoop,:))end%for relBWLoop% ----------------------------------------------------------------------- %% Plotting of results.% ----------------------------------------------------------------------- %%figure%pm=2; pn=2; pnr=1; %subplot(pm,pn,pnr)%figure%subplot(pm,pn,pnr),pnr=pnr+1;%semilogx(relBW,r2d(meanDoa(:,:,1)))plotvsbw(relBW,meanDoa(:,:,1), 1)ylabel('DOA 1 [degrees]')title('Mean')%legend('dml','sml','wsf','ssf','rmusic','esprit')ymin(-0.5)%figure%subplot(pm,pn,pnr),pnr=pnr+1;%semilogx(relBW,r2d(meanDoa(:,:,2)))plotvsbw(relBW,meanDoa(:,:,2),2)ylabel('DOA 2 [degrees]')title('Mean')%legend('dml','sml','wsf','ssf','rmusic','esprit')ymin(-0.5)%figure%subplot(pm,pn,pnr),pnr=pnr+1;%semilogx(relBW,r2d(stdDoa(:,:,1)))plotvsbw(relBW,stdDoa(:,:,1),3)ylabel('DOA 2 [degrees]')title('Std.Dev.')%legend('dml','sml','wsf','ssf','rmusic','esprit')ymin(-0.1)%figure%subplot(pm,pn,pnr),pnr=pnr+1;%semilogx(relBW,r2d(stdDoa(:,:,2)))plotvsbw(relBW,stdDoa(:,:,2),4)ylabel('DOA 2 [degrees]')title('Std.Dev.')%legend('dml','sml','wsf','ssf','rmusic','esprit')ymin(-0.1)eeTimeVar = eetimeend(eeTimeVar); % Display final execution time.% ----------------------------------------------------------------------- %% Saving and printing results.% ----------------------------------------------------------------------- %elapTime = eeTimeVar.elapTime;save wideex3 estDoaAll meanDoa stdDoa realNoSrc spec noTrials relBW elapTime SNRif (0) printfm wideex3a1 1 12 printfm wideex3a2 2 8 printfm wideex3a3 3 8 printfm wideex3a4 4 8 printfm wideex3a5 5 8 figure(2),ylim([16 26]) figure(3),ylim([31 41]) figure(4),ylim([0 5]) figure(5),ylim([0 5]) printfm wideex3b2 2 8 printfm wideex3b3 3 8 printfm wideex3b4 4 8 printfm wideex3b5 5 8 %quit % Exists MATLAB and releases memory.end%ifif (nargout > 0) estDoaAllOut = estDoaAll;endfunction plotvsbw(relBW, quantity, subFigNo, xScaleType) if (nargin < 4) xScaleType = 'lin'; end%if pm=2; pn=2; %subplot(pm,pn,subFigNo) figure if (strcmp(xScaleType,'log')) semilogx(relBW,r2d(quantity(:,:,1))) else plot(relBW,r2d(quantity(:,:,1))) end%if xlabel('Relative bandwidth') legend('dml','sml','wsf','ssf','rmusic','esprit')%endfunction plotvsbw
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -