* Bug 6973 fixed: missing stable demo figure
[scilab.git] / scilab / modules / signal_processing / demos / winfilt.dem.sce
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) ????-2008 - INRIA
3 // Copyright (C) 2010 - DIGITEO - Allan CORNET
4 //
5 // This file is released under the 3-clause BSD license. See COPYING-BSD.
6
7 function demo_winfilt()
8
9     ////////////////////////
10     //WINDOWED FIR FILTERS//
11     ////////////////////////
12
13     // Low pass filter (length 33, Kaiser window, cut-off .2)
14     [wft, wfm, fr] = wfir("lp",33,[.2 0],"kr",[5.6 0]);
15
16     my_handle = scf(100001);
17     if is_handle_valid(my_handle) then
18         clf(my_handle,"reset");
19         demo_viewCode("winfilt.dem.sce");
20         plot2d(fr', log(wfm)')
21         xtitle(" ", _("frequency"), _("magnitude"));
22         xtitle([_("Windowed FIR Low pass Filter"); ..
23         _("Kaiser window, cut-off: 0.2"); ..
24         _("length 33")]);
25
26         halt(_("Press Return to continue ... \n"));
27     end
28
29     // Stop band filter (length 127, Hamming window, cut-offs .2 and .3)
30     [wft, wfm, fr] = wfir("sb",127,[.2 .3],"hm",[0 0]);
31     if is_handle_valid(my_handle) then
32         clf(my_handle,"reset");
33         demo_viewCode("winfilt.dem.sce");
34         plot2d(fr',log(wfm)')
35         xtitle(" ", _("frequency"), _("magnitude"));
36         xtitle([_("Windowed FIR Low pass Filter"); ..
37         _("Hamming window, cut-off: 0.2, 0.3"); ..
38         _("length 127")]);
39
40         halt(_("Press Return to continue ... \n"));
41     end
42
43     // Band pass filter (length 55, Chebyshev window, cut-offs .15 and .35)
44     [wft, wfm, fr] = wfir("bp",55,[.15 .35],"ch",[.001 -1]);
45     if is_handle_valid(my_handle) then
46         clf(my_handle,"reset");
47         demo_viewCode("winfilt.dem.sce");
48         plot2d(fr',log(wfm)')
49         xtitle(" ", _("frequency"), _("magnitude"));
50         xtitle([_("Windowed FIR Band pass Filter"); ..
51         _("Chebyshev window, cut-off: 0.15, 0.35"); ..
52         _("length 55")]);
53
54         halt(_("Press Return to continue ... \n"));
55     end
56
57 endfunction
58
59 demo_winfilt();
60 clear demo_winfilt;