## "Fossies" - the Fresh Open Source Software Archive

### Member "MACE1.6.0/exampleScripts/signalprocessing.txt" (18 Mar 2019, 1564 Bytes) of package /windows/misc/MACE1.6.0.zip:

As a special service "Fossies" has tried to format the requested text file into HTML format (style:

standard) with prefixed line numbers.
Alternatively you can here

view or

download the uninterpreted source code file.

1 %Copyright (C) 2018 Jan Christian Rohde
2 %
3 %This file is part of MACE.
4 %
5 %MACE is free software; you can redistribute it and/or modify it under the terms of the
6 %GNU General Public License as published by the Free Software Foundation; either version 3
7 %of the License, or (at your option) any later version.
8 %
9 %MACE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10 %even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %GNU General Public License for more details.
12 %
13 %You should have received a copy of the GNU General Public License
14 %along with MACE; if not, see http://www.gnu.org/licenses.
15
16 % This script contains examples concerning Signal Processing.
17
18 setCharacteristic(0)
19
20 % First a simple example of a convolution
21
22 f=pcf(1,1);
23 convolution=conv(f,f,4);
24 plot(f, convolution);
25
26 % Evaluate the convolution
27 convolution(0):
28 convolution(1):
29 convolution(2):
30 convolution(3):
31 convolution(4):
32
33 % Next some Fourier and inverse Fourier transform examples
34
35 dirac=0.5(delta(-2,20)+delta(2,20));
36 wave=invFourier(dirac,-3,3);
37 plot(dirac,wave);
38
39 frequenciesOfSinusoidal=imag(fourier(sin(6.28x),-5,5));
40 plot(frequenciesOfSinusoidal);
41
42 % Again you can easily evaluate:
43 frequenciesOfSinusoidal(-1):
44 frequenciesOfSinusoidal(0):
45 frequenciesOfSinusoidal(1):
46
47 % Note that we have evaluated the imaginary part of the Fourier transform above.
48 % For an evaluation of the Fourier transform itself insert:
49 fourier(sin(6.28x),-5,5)(1):
50
51 pulses=plf(1,0,0,1,0,0,1);
52 spec=abs(fourier(pulses,0,8));
53 plot(pulses,spec);
54