Furier c + +
# define PI 3.141593 # define xydim
T / / T is a fixed value defined by the user.
/ / can also be passed to the function.
Fourier1 void (imag, freal, FIMAG) {
/ / receive 'image' as a two-dimensional array
/ / the values \u200b\u200bthat keep the 'x' and 'y'
/ / 'freal' the real part of the outcome and 'FIMAG'
/ / the imaginary
double imag [] [xydim]
freal double [] [xydim]
FIMAG double [] [xydim] double phi
, sum1, Sum2;
sum1 = 0;
Sum2 = 0;
for ( int x = 0, x - xydim; x + +) {
for (int y = 0, and - xydim, and + +) {
phi = 2 * PI * (i * x + j * y) / xydim;
sum1 sum1 + = imag [x] [y] * cos (phi);
Sum2 = Sum2 + imag [x] [y] * sin (phi);
Freal
}} [i] [j] = sum1 / xydim;
FIMAG [i] [j] =-Sum2 / xydim;
}}
0 comments:
Post a Comment