필터 지우기
필터 지우기

IFFT2 as a Symbolic Function

조회 수: 2 (최근 30일)
John Shackleton
John Shackleton 2020년 8월 10일
I have a 2D matrix which I would like to take an explicit derivative with, so it may be helpful to have a functional form of the matrix. I thought performing a 2D FFT and then expressing the matrix in terms of the Fourier basis would be a good idea, but I'm having some difficulties. I'd like that if given parameters of an x, y meshgrid and the matrix f (which is a function of x and y) over the meshgrid, the function would create a function f2 such that f2(x(ii, jj), y(ii, jj)) = f(ii, jj).
xc = -10;
yc = -10;
d = -0.1;
[x, y] = meshgrid(xc:d:10, yc:d:10);
f = sin(x + y);
m = size(f, 1);
n = size(f, 2);
coefs = fft2(f);
omega_x = exp((2*pi.*1i./n).*(0:(n-1)));
omega_y = exp((2*pi.*1i./n).*(0:(m-1)));
omega_y = omega_y';
func = @(x, y) (1/m).*(1/n).*sum( ...
sum( ...
(omega_x.^((x-xc)./d).* ...
(omega_y.^((y-yc)./d))) ...
.*coefs ...
) ...
);
f2 = zeros(size(f));
for ii = 1:size(f, 1)
for jj = 1:size(f, 2)
f2(ii, jj) = func(x(ii, jj), y(ii, jj));
end
end
And we should have matrices f2 and f be similar.
Thanks for your help!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by