Help Me Solve FFT Sinc Function Problem

In summary, the student is trying to do a two-dimensional FFT on a square function that is the sinc function. However, he is having trouble understanding the second plot and is looking for help. He is also asking about how to do a two-dimensional FFT and where to find the function fft2.
  • #1
Jmas
5
0
Hello, I am a physics engineering student and i need a little help with fft function. I wrote the following code everything works, but when i get the fft. I was supose to obtain a sinc function and if you take a close look, it is a sinc, but in the wrong points, can anyone help me with this?

if you don't know/remember what a sinc function looks like:
https://www.google.pt/search?q=3d+s...%2Fwiki%2FFile%3AMatlab_surf_sinc.svg;561;420

x0=0;
y0=0;
dx=5;
dy=5;
px=0.05;
py=0.05;
dxx=1;
dyy=1;
n=dx/px+1;
m=dy/py+1;

xx=-dx/2:px:dx/2;
yy=-dy/2:py:dy/2;

[X,Y]=meshgrid(xx,yy);

Z=zeros(n,m);

%w=X.^2+Y.^2;

for i=1:n
for j=1:m
if X(i,j)>=x0-dxx/2 && X(i,j)<=x0+dxx/2 && Y(i,j)>=y0-dyy/2 && Y(i,j)<=y0+dyy/2
Z(i,j)=1;
end
end
end

A=fft(Z);
B=A.*conj(A);

figure(1)
surf(X,Y,Z)
colormap jet
colorbar

figure(2)
surf(X,Y,B)
colormap jet
colorbarAlso, how i make sure that Z, has always the size of the matrixs X and Y?
 
Physics news on Phys.org
  • #2
It would help if you explained what your code is supposed to be doing.
 
  • #3
it is suppose to plot the fft of a square function which is the sinc function. if you take a look a the photo I've just uploaded, the second one should be a sinc function.
 

Attachments

  • Sem Título.png
    Sem Título.png
    25.2 KB · Views: 436
  • #4
I don't understand the second plot. You're doing a two-dimensional FFT, right? Why do you have a one-dimensional power spectrum?
 
  • #5
its 2d too...
 
  • #6
Really? I don't see depth in the second plot, unlike the first one.
 
  • #7
and now?
 

Attachments

  • Sem Título.png
    Sem Título.png
    55 KB · Views: 419
  • #8
I'm assuming this is MATLAB code. According to the documentation, the routine fft doesn't do a two-dimensional DFT. It only acts on the first non-singleton dimension.

EDIT: It looks like the function you want is fft2.
 
  • #9
humm ok, and how do i center it?
 
  • #10
Probably easiest just to rotate the rows and columns by 50 positions.
 

Related to Help Me Solve FFT Sinc Function Problem

1. What is the FFT Sinc function?

The FFT Sinc function is a mathematical function used in signal processing to represent a frequency spectrum. It is the Fourier Transform of the Sinc function, which is defined as the inverse Fourier Transform of the rectangular pulse function.

2. What is the purpose of solving the FFT Sinc function problem?

The purpose of solving the FFT Sinc function problem is to accurately represent and analyze a signal's frequency components. By solving this problem, we can obtain the amplitude and phase of each frequency component, which can then be used for further analysis and manipulation of the signal.

3. What are the common challenges in solving the FFT Sinc function problem?

Some common challenges in solving the FFT Sinc function problem include understanding the mathematical concepts behind the function, selecting an appropriate sampling rate and window size, and dealing with potential aliasing and leakage effects.

4. How do you solve the FFT Sinc function problem?

The FFT Sinc function problem can be solved using various mathematical techniques, such as the Fast Fourier Transform algorithm. This algorithm breaks down the problem into smaller sub-problems, making it more efficient to compute. Additionally, there are many software packages available that can solve the FFT Sinc function problem for you.

5. What are some practical applications of the FFT Sinc function?

The FFT Sinc function has various applications in signal processing, such as in audio and image processing, telecommunications, and radar systems. It is also commonly used in scientific research, particularly in fields such as astronomy, physics, and chemistry.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
13K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
Replies
1
Views
939
Back
Top