Borrar filtros
Borrar filtros

fft-based differentiation on a non-periodic time span

5 visualizaciones (últimos 30 días)
bazrafshan88@gmail.com
bazrafshan88@gmail.com el 8 de Dic. de 2016
Comentada: zhoumu wu el 23 de Oct. de 2020
Hi everybody
I'm puzzled with a basic property of the Fourier transform. We all know that if the fourier transform of f(t) is F(w), then the fourier transform of df/dt is simply jwF(w). Well, to show this numerically using fft you need your f(t) to be periodic on your time span. Suppose that you define f(x) = sin(x) for -pi<x<pi. I want to show that fft(cos(x)) = jw*fft(sin(x)). Consider the following code:
clc
clear
close all
N = pow2(6);
a = pi;
dx = 2*a/N;
x = -a+dx*(0:N-1);
m = 2*pi/(2*a)*[0:N/2-1, 0, -N/2+1:-1];
%%
f = sin(x);
fx = cos(x); % df/dx
Ff = fft(f);
Ffx = 1i*m.*Ff;
iFfx = real(ifft(Ffx(:),'symmetric'));
plot(x,iFfx,'b')
hold on
plot(x,fx,'ro')
which is perfect. But the problem arises when the function is not periodic over the specified domain. For example, if I choose a = 1 in the example above, I wouldn't be satisfied with the results anymore. Are there any tricks so that I can solve this problem?
Any suggestion is appreciated.
  1 comentario
zhoumu wu
zhoumu wu el 23 de Oct. de 2020
sunaina2018-Calculating Numerical Derivatives using Fourier Transform some pitfalls and how to avoid them

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by