# 4.7 Java1491-2d fourier transforms using java, part 2  (Page 4/21)

 Page 4 / 21

## The xform2D method

The beginning of the class and the beginning of the static method named xform2D is shown in Listing 1 .

This method computes a forward 2D Fourier transform from the space domain into the wavenumber domain. The number of points produced for the wavenumberdomain matches the number of points received for the space domain in both dimensions. Note that the input data must be purely real. In other words, theprogram assumes that there are no imaginary values in the space domain. Therefore, this is not a general purpose 2D complex-to-complex transform.

Listing 1. Beginning of the class named ImgMod30.
```class ImgMod30{ static void xform2D(double[][] inputData,double[][]realOut, double[][] imagOut,double[][]amplitudeOut){ int height = inputData.length;int width = inputData.length;System.out.println("height = " + height);System.out.println("width = " + width);```

## Parameters

The first parameter is a reference to a 2D double array object containing the data to be transformed. The remaining three parameters arereferences to 2D double array objects of the same size that will be populated with the following transform results:

• The real part
• The imaginary part
• The amplitude (square root of sum of squares of the real and imaginary parts)

Listing 1 also determines and displays the dimensions of the incoming 2D array of data to be transformed.

I won't bore you with the details as to how and why the 2D Fourier transform does what it does. Neither will I bore you with the details of the code thatimplements the 2D Fourier transform. If you understand the material that I have previously published on Fourier transforms in one dimension, this code and these concepts should be astraightforward extension from one dimension to two dimensions.

## The remainder of the xform2D method

The remainder of the xform2D method is shown in Listing 2 . Note that it was necessary to sacrifice indentation in order to force these very long equationsto be compatible with this narrow publication format and still be somewhat readable.

Listing 2. The remainder of the xform2D method.
```//Two outer loops iterate on output data. for(int yWave = 0;yWave<height;yWave++){ for(int xWave = 0;xWave<width;xWave++){ //Two inner loops iterate on input data.for(int ySpace = 0;ySpace<height; ySpace++){for(int xSpace = 0;xSpace<width; xSpace++){//Compute real, imag, and ampltude. realOut[yWave][xWave] +=(inputData[ySpace][xSpace]*cos(2*PI*((1.0* xWave*xSpace/width)+(1.0*yWave*ySpace/height))))/sqrt(width*height);imagOut[yWave][xWave ]-= (inputData[ySpace][xSpace]*sin(2*PI*((1.0*xWave*xSpace/width) + (1.0*yWave*ySpace/height)))) /sqrt(width*height);amplitudeOut[yWave][xWave] =sqrt( realOut[yWave][xWave] * realOut[yWave][xWave] +imagOut[yWave][xWave]* imagOut[yWave][xWave]); }//end xSpace loop}//end ySpace loop }//end xWave loop}//end yWave loop }//end xform2D method```

## The inverseXform2D method

The inverseXform2d method is shown in its entirety in Listing 3 . This method computes an inverse 2D Fourier transform from the complex wavenumber domain into thereal space domain. The number of points produced for the space domain matches the number of points received for the wavenumber domain in both dimensions.

how do I set up the problem?
what is a solution set?
Harshika
find the subring of gaussian integers?
Rofiqul
hello, I am happy to help!
Abdullahi
hi mam
Mark
find the value of 2x=32
divide by 2 on each side of the equal sign to solve for x
corri
X=16
Michael
Want to review on complex number 1.What are complex number 2.How to solve complex number problems.
Beyan
yes i wantt to review
Mark
use the y -intercept and slope to sketch the graph of the equation y=6x
how do we prove the quadratic formular
Darius
hello, if you have a question about Algebra 2. I may be able to help. I am an Algebra 2 Teacher
thank you help me with how to prove the quadratic equation
Seidu
may God blessed u for that. Please I want u to help me in sets.
Opoku
what is math number
4
Trista
x-2y+3z=-3 2x-y+z=7 -x+3y-z=6
can you teacch how to solve that🙏
Mark
Solve for the first variable in one of the equations, then substitute the result into the other equation. Point For: (6111,4111,−411)(6111,4111,-411) Equation Form: x=6111,y=4111,z=−411x=6111,y=4111,z=-411
Brenna
(61/11,41/11,−4/11)
Brenna
x=61/11 y=41/11 z=−4/11 x=61/11 y=41/11 z=-4/11
Brenna
Need help solving this problem (2/7)^-2
x+2y-z=7
Sidiki
what is the coefficient of -4×
-1
Shedrak
the operation * is x * y =x + y/ 1+(x × y) show if the operation is commutative if x × y is not equal to -1
An investment account was opened with an initial deposit of \$9,600 and earns 7.4% interest, compounded continuously. How much will the account be worth after 15 years?
lim x to infinity e^1-e^-1/log(1+x)
given eccentricity and a point find the equiation
A soccer field is a rectangle 130 meters wide and 110 meters long. The coach asks players to run from one corner to the other corner diagonally across. What is that distance, to the nearest tenths place.
Jeannette has \$5 and \$10 bills in her wallet. The number of fives is three more than six times the number of tens. Let t represent the number of tens. Write an expression for the number of fives.
What is the expressiin for seven less than four times the number of nickels
How do i figure this problem out.
how do you translate this in Algebraic Expressions
why surface tension is zero at critical temperature
Shanjida
I think if critical temperature denote high temperature then a liquid stats boils that time the water stats to evaporate so some moles of h2o to up and due to high temp the bonding break they have low density so it can be a reason
s.
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Got questions? Join the online conversation and get instant answers! By OpenStax By Anonymous User By OpenStax By OpenStax By Rohini Ajay By OpenStax By Dewey Compton By Abby Sharp By Edgar Delgado By Joli Julianna