Home > vbmeg > functions > estimation > bayes > vb_temporal_smooth.m

vb_temporal_smooth

PURPOSE ^

temporal smoothing

SYNOPSIS ^

function bexp2=vb_temporal_smooth(bexp)

DESCRIPTION ^

 temporal smoothing

 Originaly written by S.Kajihara
 Ver 2.0  modified by M. Sato  2004-9-25
 2005-03-29 Modified by Taku Yoshioka

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    bexp2=vb_temporal_smooth(bexp)
0002 % temporal smoothing
0003 %
0004 % Originaly written by S.Kajihara
0005 % Ver 2.0  modified by M. Sato  2004-9-25
0006 % 2005-03-29 Modified by Taku Yoshioka
0007 %
0008 % Copyright (C) 2011, ATR All Rights Reserved.
0009 % License : New BSD License(see VBMEG_LICENSE.txt)
0010 
0011 Nfwd    = 2;
0012 Nbck    = 2;
0013 Nwidth    = Nfwd + Nbck +1;% Window length = 5
0014 Nwidth0 = Nfwd + 1;
0015 
0016 bexp2        = bexp;
0017 [Nch,Tsamp] = size(bexp2);
0018 bexp3        = zeros(Nch,Tsamp);
0019 t           = 3:Tsamp-2;
0020 
0021 for k=1:3,
0022     %bexp3(:,1) = bexp2(:,1);
0023     %bexp3(:,2) = sum(bexp2(:,1:3),2)/Nwidth0;
0024     bexp3(:,1) = sum(bexp2(:,1:3),2)/3;
0025     bexp3(:,2) = sum(bexp2(:,1:4),2)/4;
0026     
0027     bexp3(:,t) = (bexp2(:,t-2) + bexp2(:,t-1) + bexp2(:,t) ...
0028                 + bexp2(:,t+2) + bexp2(:,t+1))/Nwidth; 
0029     
0030     %bexp3(:,Tsamp-1) = sum(bexp2(:,Tsamp-2:Tsamp),2)/Nwidth0;
0031     %bexp3(:,Tsamp)   = bexp2(:,Tsamp);
0032     bexp3(:,Tsamp-1) = sum(bexp2(:,Tsamp-3:Tsamp),2)/4; 
0033     bexp3(:,Tsamp)   = sum(bexp2(:,Tsamp-2:Tsamp),2)/3;
0034     
0035     bexp2 = bexp3;
0036 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005