%Copyright (C) 2018 Jan Christian Rohde
%
%This file is part of MACE.
%
%MACE is free software; you can redistribute it and/or modify it under the terms of the
%GNU General Public License as published by the Free Software Foundation; either version 3
%of the License, or (at your option) any later version.
%
%MACE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
%even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%GNU General Public License for more details.
%
%You should have received a copy of the GNU General Public License
%along with MACE; if not, see http://www.gnu.org/licenses.
% This script contains examples concerning Signal Processing.
setCharacteristic(0)
% First a simple example of a convolution
f=pcf(1,1);
convolution=conv(f,f,4);
plot(f, convolution);
% Evaluate the convolution
convolution(0):
convolution(1):
convolution(2):
convolution(3):
convolution(4):
% Next some Fourier and inverse Fourier transform examples
dirac=0.5(delta(-2,20)+delta(2,20));
wave=invFourier(dirac,-3,3);
plot(dirac,wave);
frequenciesOfSinusoidal=imag(fourier(sin(6.28x),-5,5));
plot(frequenciesOfSinusoidal);
% Again you can easily evaluate:
frequenciesOfSinusoidal(-1):
frequenciesOfSinusoidal(0):
frequenciesOfSinusoidal(1):
% Note that we have evaluated the imaginary part of the Fourier transform above.
% For an evaluation of the Fourier transform itself insert:
fourier(sin(6.28x),-5,5)(1):
pulses=plf(1,0,0,1,0,0,1);
spec=abs(fourier(pulses,0,8));
plot(pulses,spec);