フィルターのクリア

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 Center および File ExchangeDiscrete 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