| 1 | % 'signal_band_filter': example of pass-band filter (using the signal toolbox fct fdesign)
|
---|
| 2 | % frequency and bandwidth need to be modified in the function
|
---|
| 3 | %
|
---|
| 4 | % OUTPUT:
|
---|
| 5 | % DataOut: Matlab structure representing the output (filtered) field
|
---|
| 6 | %
|
---|
| 7 | %INPUT:
|
---|
| 8 | % DataIn: Matlab structure representing the output field
|
---|
| 9 |
|
---|
| 10 | %=======================================================================
|
---|
| 11 | % Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
|
---|
| 12 | % http://www.legi.grenoble-inp.fr
|
---|
| 13 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
|
---|
| 14 | %
|
---|
| 15 | % This file is part of the toolbox UVMAT.
|
---|
| 16 | %
|
---|
| 17 | % UVMAT is free software; you can redistribute it and/or modify
|
---|
| 18 | % it under the terms of the GNU General Public License as published
|
---|
| 19 | % by the Free Software Foundation; either version 2 of the license,
|
---|
| 20 | % or (at your option) any later version.
|
---|
| 21 | %
|
---|
| 22 | % UVMAT is distributed in the hope that it will be useful,
|
---|
| 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 25 | % GNU General Public License (see LICENSE.txt) for more details.
|
---|
| 26 | %=======================================================================
|
---|
| 27 |
|
---|
| 28 | function DataOut=signal_bandpass_filter(DataIn)
|
---|
| 29 | %% set GUI config
|
---|
| 30 | DataOut=[];
|
---|
| 31 | if strcmp(DataIn,'*')
|
---|
| 32 | DataOut.InputFieldType='1D';
|
---|
| 33 | return
|
---|
| 34 | end
|
---|
| 35 | %%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
| 36 | frequency=2*5/54.5;% frequency at which the signal needs to be filetered
|
---|
| 37 | %d=fdesign.bandpass(0.8*frequency, 0.95*frequency, 1.05*frequency, 1.2*frequency, 60, 1, 60);
|
---|
| 38 | d=fdesign.bandpass(0.7*frequency, 0.9*frequency, 1.1*frequency, 1.3*frequency, 60, 1, 60);
|
---|
| 39 | Hd=design(d);% command fvtool(Hd) to visualize the filter frequency response
|
---|
| 40 | DataOut=DataIn;
|
---|
| 41 | if isfield(DataIn,'U')
|
---|
| 42 | DataOut.U = filter(Hd,DataIn.U);
|
---|
| 43 | end
|
---|
| 44 | if isfield(DataIn,'V')
|
---|
| 45 | DataOut.V = filter(Hd,DataIn.V);
|
---|
| 46 | end
|
---|
| 47 |
|
---|