2D Fourier transform for surface fitting

I'm having a scattered x,y,z data and I'm looking for the Fourier series which can fit the scattered data forming a surface. Can anyone suggest any good method that can be adopted for this. I've tried using fft2 but the data is very random, the amplitude and phase spectra are very difficult to be interpreted.

답변 (1개)

Image Analyst
Image Analyst 2021년 9월 3일

0 개 추천

Did you try making your data into an image with scatteredInterpolant and then calling fft2, and then zeroing out the high frequency components, then inverse transforming. I've attached some demos that might help.

댓글 수: 4

Can you please explain this a little more, I'm not able to catch up with the idea.
Thanks,
If you plot your z as an image, then if you have scattered x and y (not a complete grid of all points) you'll have to use scatteredInterpolant to get z for every value of x and y. Now you basically have a surface where z is the height of the surface. Did you actually try the demo yet?
So that's the actual surface. Now you said you wanted to "fit" a surface so I assume that maybe you want some regression/fit to smooth the surface. The surface will be spiky if there are high frequencies in the z image. If you get rid of those, then it will be smoother. So get a frequency image by calling fft2. Then you can erase the high frequencies in the center of the image (or in the outer part of the image if you used fftshift to put the origin at the center of the image) by setting them to zero. Now if you inverse transform with ifft2(), those high frequencies will not be there and the surface/image will be smoother. Does that make sense?
Thanks for the response. I'm trying to actually denote the 'z' values as the function of 'x' & 'y' values in trigonometric functions (like Fourier series). I tried to interpret the data, but I'm not able to find the amplitudes and phase angle to convert the data into Fourier series.
What's the function? Like sin(x) + cos(y) or something? Should be just a few lines of code if you use meshgrid to get a list of all (x,y) locations.
x1 = linspace(0, 5*pi, 400);
y1 = linspace(0, 3*pi, 300);
xPeriod = 2;
yPeriod = 2.4;
amplitude = 5;
[x, y] = meshgrid(x1, y1);
z = amplitude * (sin(2 * pi * x / xPeriod) + cos(2 * pi * y / yPeriod));
surf(x, y, z, 'Lines', 'none');
grid on;

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

질문:

2021년 9월 3일

댓글:

2021년 9월 4일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by