📄 simulate.m
字号:
function [PAR, FLO, STA, AVG, MSE, VAR, BIQ, EInfo]= simulate(exp, N, SNR, par, E, re_im, MM, MAR, LAR, MMA, LMA)%function [PAR, FLO, STA, AVG, MSE, VAR, BIQ, EInfo]= simulate(exp, N, SNR, par, E, re_im, MM, MAR, LAR, MMA, LMA)% This file is part of the TFPM toolbox v1.0 (c)% michael.jachan@tuwien.ac.at and underlies the GPL.% % This is a meta-function to perform MSE estimates for various% signal lenghts N, <SNR> values in dB, of re_im-valued parameter% estimators. %% The matrix <par> is the reference value for the parameters <PAR>% to be estimated, <E> is the expected energy of the generated% signal used to compute the noise variance. <MM> is the ensemble% size. The various parallel running estimators are defined in the% script tfpm_simu_define_<exp>.m. Data generation of the noisy data% vector is done in the script tfpm_simu_generate_<exp>.m. The% TF-multiwindow is defined in tfpm_simu_win_<exp>.m. The% estimation of unwindowed second-order signal statistics is done% in tfpm_simu_stat_<exp>.m. Before/after each estimation the% defpre/defpos script is called. STA is the status of the% estimator. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if(0)% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear;tfpm;N = 64;MAR = 2;LAR = 2;MMA = 1;LMA = LAR;re_im= 'r';mo_no= 'm';N0= N;N= 128;tfpm_file_gen;%-------------N= N0;alpha= 1/2;beta = 1/2;%exp= 'tfma';par= param_expand(Bml, N);E= tfarma_ambi(Aml, Bml, N, alpha);E= E(N/2+1, N/2+1);%exp= 'tfar';par= [Aml(:, 2:end) Bml];E= tfarma_ambi(Aml, Bml, N, alpha);E= E(N/2+1, N/2+1);exp= 'tfarma';par= [Aml(:, 2:end); param_expand(Bml, N)];E= tfarma_ambi(Aml, Bml, N, alpha);E= E(N/2+1, N/2+1);% SNR values in dB%SNR= [10 6 3 0 -3 -6 -10];SNR= inf;% Ensemble sizeMM= 10;mm= 1;snr= 1;ee= 1;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end;% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Number of parameters:NPAR= size(par, 1)*size(par, 2);alpha= 1/2;beta = 1/2;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINE THE ESTIMATORS AND THEIR CALLS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%defpre_string= sprintf('tfpm_simu_defpre_%s', lower(exp));define_string= sprintf('tfpm_simu_define_%s', lower(exp));defpos_string= sprintf('tfpm_simu_defpos_%s', lower(exp));eval(defpre_string);eval(define_string);eval(defpos_string);esti= size(ESTI, 1);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINE THE DATA GENERATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%generate_string= sprintf('tfpm_simu_generate_%s', lower(exp));%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINE THE WINDOW FUNCTION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%win_string= sprintf('tfpm_simu_win_%s', lower(exp));eval(win_string);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINE THE ESTIMATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%stat_string= sprintf('tfpm_simu_stat_%s', lower(exp));%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ESTIMATE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Parameter array:PAR= zeros([size(par), MM, length(SNR), esti]);% Flops counter:FLO= [];% Status flag:STA= [];for mm= 1:MM for snr= 1:length(SNR) variance= E/N/10^(SNR(snr)/10); eval(generate_string) sprintf('%s, N= %4d, SNR= %3ddB, mm= %4d%d%d%d%d', exp, N, ... SNR(snr), mm, MAR, LAR, MMA, LMA) eval(stat_string); flopsee= []; statee = []; for ee= 1:esti% ee% sprintf('1') eval(SPRE(ee, :));% sprintf('2') flops(0)% sprintf('3') eval(ESTI(ee, :));% sprintf('4') flopsee= [flopsee flops];% sprintf('5') eval(SPOS(ee, :));% sprintf('6') statee = [statee estistat];% sprintf('7') PAR(:, :, mm, snr, ee)= estimate;% sprintf('8') end; FLO= [FLO; flopsee]; STA= [STA; statee]; end;end;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% STATISTICAL RESULTS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%AVG= zeros([size(par), length(SNR), esti]);VAR= AVG;BIQ= VAR;for snr= 1:length(SNR) for ee= 1:esti AVG(:, :, snr, ee)= mean(PAR(:, :, :, snr, ee), 3); VAR(:, :, snr, ee)= abs(std(PAR(:, :, :, snr, ee), 1, 3)).^2; BIQ(:, :, snr, ee)= abs( (AVG(:, :, snr, ee)-par)).^2; [M, V, B]= param_mse(PAR(:, :, :, snr, ee), par); end;end;MSE= BIQ+VAR;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -