⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plot_tfarma.m

📁 用于模拟时变非平稳的ARMA过程
💻 M
字号:
function plot_tfarma(MAR0, LAR0, MMA0, LMA0, N0, re_im, fig)% function plot_tfarma(MAR0, LAR0, MMA0, LMA0, N0, re_im, fig)%   This file is part of the TFPM toolbox v1.0 (c)%   michael.jachan@tuwien.ac.at and underlies the GPL.% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if(0)% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%plot_tfarma(1, 1, 1, 1, 128, 'r', 1)clear;tfpm;MAR0= 1;LAR0= 1;MMA0= 1;LMA0= 1;N0= 128;re_im= 'r';%n= 6;N= 2^n;%MAR= 1;%LAR= 1;fig= 1;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end;% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%exp= 'tfarma';nmin= 6;MARmin= 1;LARmin= 1;MMAmin= 1;LMAmin= 1;nmax= 8;MARmax= 2;LARmax= 1;MMAmax= 1;LMAmax= 1;%style= ['- '; ': '; '-.'; '--'; '- '];style= ['-.'; '- '; '-.'; '--'; '- '];% Check for presence of files;)for n= nmax:-1:nmin;N= 2^n;   for MAR= MARmax:-1:MARmin      for MMA= MMAmin:MMAmax         for L= LARmax:-1:LARmin	    resultname= sprintf('data/%04d/%s%d%d%d%d%s.mat', N, exp, MAR, L, MMA, L, re_im)            load(resultname)	 end;      end;   end;end;esti= size(EInfo, 1);esti= 2filename= sprintf('/users/mjachan/tex/prj/TF/figures/tfar%02d%02d%02d%02d%02d%1s', MAR0, LAR0, MMA0, LMA0, log2(N0), re_im)figure(fig);clf;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Plot MSE/VAR/BIQ over N:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%MSEn= [];VARn= [];BIQn= [];for n= nmin:nmax;N= 2^n;   resultname= sprintf('data/%04d/%s%d%d%d%d%s.mat', N, exp, MAR0, LAR0, MMA0, LMA0, re_im)   load(resultname);   MSEnee= [];   VARnee= [];   BIQnee= [];   for ee= 1:esti      MSEnee= [MSEnee; sum(sum(MSE(:, :, 1, ee)))/sum(sum(abs(par).^2))];      VARnee= [VARnee; sum(sum(VAR(:, :, 1, ee)))/sum(sum(abs(par).^2))];      BIQnee= [BIQnee; sum(sum(BIQ(:, :, 1, ee)))/sum(sum(abs(par).^2))];   end;   MSEn= [MSEn MSEnee];   VARn= [VARn VARnee];   BIQn= [BIQn BIQnee];end;MAXn= max(max([MSEn VARn BIQn]));MAXn= ceil(10*MAXn)/9.5;%subplot(3, 3, 1);cla;hold onsubplot(3, 2, 1);cla;hold onfor ee= 1:esti   plot(MSEn(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(nmax~=nmin)   axis([1 nmax-nmin+1 0 MAXn]);   box;gridend;set(gca, 'XTick', 1:nmax-nmin+1)set(gca, 'XTicklabel', 2.^(nmin:nmax))ylabel('MSE')%xlabel('N')title(sprintf('M0= %d, L0= %d', MAR0, LAR0));%subplot(3, 3, 4);cla;hold onsubplot(3, 2, 3);cla;hold onfor ee= 1:esti   plot(VARn(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(nmax~=nmin)   axis([1 nmax-nmin+1 0 MAXn]);   box;gridend;set(gca, 'XTick', 1:nmax-nmin+1)set(gca, 'XTicklabel', 2.^(nmin:nmax))ylabel('VAR')%xlabel('N')%subplot(3, 3, 7);cla;hold onsubplot(3, 2, 5);cla;hold onfor ee= 1:esti   plot(BIQn(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(nmax~=nmin)   axis([1 nmax-nmin+1 0 MAXn]);   box;gridend;set(gca, 'XTick', 1:nmax-nmin+1)set(gca, 'XTicklabel', 2.^(nmin:nmax))ylabel('BIQ')xlabel('N')%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Plot MSE/VAR/BIQ over MAR:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%MSEmar= [];VARmar= [];BIQmar= [];for MAR= MARmin:MARmax;   resultname= sprintf('data/%04d/%s%d%d%d%d%s.mat', N0, exp, MAR, LAR0, MMA0, LMA0, re_im)   load(resultname);   MSEnee= [];   VARnee= [];   BIQnee= [];   for ee= 1:esti      MSEnee= [MSEnee; sum(sum(MSE(:, :, 1, ee)))/sum(sum(abs(par).^2))];      VARnee= [VARnee; sum(sum(VAR(:, :, 1, ee)))/sum(sum(abs(par).^2))];      BIQnee= [BIQnee; sum(sum(BIQ(:, :, 1, ee)))/sum(sum(abs(par).^2))];   end;   MSEmar= [MSEmar MSEnee];   VARmar= [VARmar VARnee];   BIQmar= [BIQmar BIQnee];end;MAXmar= max(max([MSEmar VARmar BIQmar]));MAXmar= ceil(10*MAXmar)/9.5;%subplot(3, 3, 2);cla;hold onsubplot(3, 2, 2);cla;hold onfor ee= 1:esti   plot(MSEmar(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(MARmax~=MARmin)   axis([1 MARmax-MARmin+1 0 MAXmar]);   box;gridend;set(gca, 'XTick', 1:MARmax-MARmin+1)set(gca, 'XTicklabel', MARmin:MARmax)%ylabel('MSE')%xlabel('M')title(sprintf('N0= %d, L0= %d', N0, LAR0));%subplot(3, 3, 5);cla;hold onsubplot(3, 2, 4);cla;hold onfor ee= 1:esti   plot(VARmar(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(MARmax~=MARmin)   axis([1 MARmax-MARmin+1 0 MAXmar]);   box;gridend;set(gca, 'XTick', 1:MARmax-MARmin+1)set(gca, 'XTicklabel', MARmin:MARmax)%ylabel('VAR')%xlabel('M')%subplot(3, 3, 8);cla;hold onsubplot(3, 2, 6);cla;hold onfor ee= 1:esti   plot(BIQmar(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(MARmax~=MARmin)   axis([1 MARmax-MARmin+1 0 MAXmar]);   box;gridend;set(gca, 'XTick', 1:MARmax-MARmin+1)set(gca, 'XTicklabel', MARmin:MARmax)%ylabel('BIQ')xlabel('M')if(0)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Plot MSE/VAR/BIQ over LAR:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%MSElar= [];VARlar= [];BIQlar= [];for LAR= LARmin:LARmax;   resultname= sprintf('data/%04d/%s%d%d%d%d%s.mat', N0, exp, MAR0, LAR, MMA0, LMA0, re_im)   load(resultname);   MSEnee= [];   VARnee= [];   BIQnee= [];   for ee= 1:esti      MSEnee= [MSEnee; sum(sum(MSE(:, :, 1, ee)))/sum(sum(abs(par).^2))];      VARnee= [VARnee; sum(sum(VAR(:, :, 1, ee)))/sum(sum(abs(par).^2))];      BIQnee= [BIQnee; sum(sum(BIQ(:, :, 1, ee)))/sum(sum(abs(par).^2))];   end;   MSElar= [MSElar MSEnee];   VARlar= [VARlar VARnee];   BIQlar= [BIQlar BIQnee];end;MAXlar= max(max([MSElar VARlar BIQlar]));MAXlar= ceil(10*MAXlar)/9.5;subplot(3, 3, 3);cla;hold onfor ee= 1:esti   plot(MSElar(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(LARmax~=LARmin)   axis([1 LARmax-LARmin+1 0 MAXlar]);   box;gridend;set(gca, 'XTick', 1:LARmax-LARmin+1)set(gca, 'XTicklabel', LARmin:LARmax)%ylabel('MSE')%xlabel('L')title(sprintf('N0= %d, M0= %d', N0, MAR0));subplot(3, 3, 6);cla;hold onfor ee= 1:esti   plot(VARlar(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(LARmax~=LARmin)   axis([1 LARmax-LARmin+1 0 MAXlar]);   box;gridend;set(gca, 'XTick', 1:LARmax-LARmin+1)set(gca, 'XTicklabel', LARmin:LARmax)%ylabel('VAR')%xlabel('L')subplot(3, 3, 9);cla;hold onfor ee= 1:esti   plot(BIQlar(ee, :), 'Linewidth', 2, 'Linestyle', deblank(style(ee, :)), 'Color', 'k')end;if(LARmax~=LARmin)   axis([1 LARmax-LARmin+1 0 MAXlar]);   box;gridend;set(gca, 'XTick', 1:LARmax-LARmin+1)set(gca, 'XTicklabel', LARmin:LARmax)%ylabel('BIQ')xlabel('L')endlegend(EInfo(1:esti, :))print('-depsc2', filename);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if(0)% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear;tfpm;for MAR0= 1:3   for LAR0= 1:3      for n0= 6:7	 plot_tfar(MAR0, LAR0, 2^n0, 'r', 1);         plot_tfar(MAR0, LAR0, 2^n0, 'i', 2);      end   endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end;% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -