1// -------------------------------------------------------------------------
2// SWT - Scilab wavelet toolbox
3// Copyright (C) 2010-2014  Holger Nahrstaedt
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18//-------------------------------------------------------------------------
19//
20//  <-- NO CHECK ERROR OUTPUT -->
21
22
23// dwt1d  Test
24
25loadmatfile("-mat",get_swt_path()+"tests/unit_tests/Data.mat");
26
27// appcoef
28[c,l]=wavedec(s1,3,'sym10');
29[cA1,cD1]=dwt(s1,'sym10');
30[cA2,cD2]=dwt(cA1,'sym10');
31[cA3,cD3]=dwt(cA2,'sym10');
32[Lo_R,Hi_R]=wfilters('sym10','r');
33cAA2=idwt(cA3,cD3,'sym10',length(cA2));
34cAA1=idwt(cAA2,cD2,'sym10',length(cA1));
35ca31=appcoef(c,l,'sym10');
36ca32=appcoef(c,l,'sym10',3);
37ca33=appcoef(c,l,Lo_R,Hi_R);
38ca34=appcoef(c,l,Lo_R,Hi_R,3);
39ca21=appcoef(c,l,'sym10',2);
40ca22=appcoef(c,l,Lo_R,Hi_R,2);
41ca11=appcoef(c,l,'sym10',1);
42ca12=appcoef(c,l,Lo_R,Hi_R,1);
43
44assert_checkalmostequal ( ca31 , cA3 , %eps );
45assert_checkalmostequal ( ca32 , cA3 , %eps );
46assert_checkalmostequal ( ca33 , cA3 , %eps );
47assert_checkalmostequal ( ca21 , cAA2 , %eps );
48assert_checkalmostequal ( ca22 , cAA2 , %eps );
49assert_checkalmostequal ( ca11 , cAA1 , %eps );
50assert_checkalmostequal ( ca12 , cAA1 , %eps );
51