From eefaa30a56281b8921b2a2f501a695ae8f881925 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Sun, 2 Jun 2019 15:39:02 +0200 Subject: add README --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e8932b --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +#Task solution - fast Fourier transform in fortran (using fftw3)# +This repository contains the realization of the [second task](http://home.agh.edu.pl/~macwozni/fort/zadanie2.pdf) of the fortran programming language course at AGH in Cracov. + +##Directory structure## + + Makefile + README.md + make_results.sh + template.gnuplot + src/ + fourier.F90 + f1_dft.gnuplot + f1_original.gnuplot + f2_dft.gnuplot + f2_filtered.gnuplot + f2_original.gnuplot + res/ + f1_dft.txt + f1_original.txt + f2_dft.txt + f2_filtered.txt + f2_original.txt + f1_dft.png + f1_original.png + f2_dft.png + f2_filtered.png + f2_original.png + +###Makefile### +This file contains recipes for building the fortran program and using to generate plots. + +###src/### +This directory contains the fortran source of the project, namely `fourier.f90` and gnuplot scripts for generating png plots. + +###res/### +This directory contains relevant plots of signals and frequency spectrums as required for the task. + +##Building## +As a prerequisite, fftw3, make and a fortran compiler, either gfortran or ifort, are required (didn't want to support proprietary compiler :c but had to). It is assumed, that include files for fftw3 are installed under `/usr/include`. +Run: + + $ make +to build the program executable `fourier`. +The makefile checks which one of the 2 compilers is present and uses it. Alternatively, one can specify fortran compiler explicitly, e.g.: + + $ make FC=gfortran +or: + + $ make FC=ifort + +##Running## +The executable is `fourier`. It's mandatory first argument is name of the function to work with - 'f1' or 'f2'. If there're no other arguments - program prints datapoints for plotting the original function. If second argument is 'dft' - program prints datapoints of function's frequency spectrum as obtained from discrete fourier transform. If second argument is 'filtered' - program prints datapoints of filtered function (with frequency components of low values removed). + + $ ./fourier f2 filtered + 0.0000000000000000 0.99737967443382569 + 1.5259021896696422E-005 0.99737363952277114 + 3.0518043793392844E-005 0.99736759544407216 + 4.5777065690089265E-005 0.99736154219778428 + ⋮ + 0.99996948195620661 0.99739772416056849 + 0.99998474097810330 0.99739171675277982 + 1.0000000000000000 0.99738570017718042 + +Text files and plots in `res/` can be regenerated by issuing + + $ make pngs + +from the main project directory. + -- cgit v1.2.3