fft-based differentiation on a non-periodic time span

1 回表示 (過去 30 日間)
bazrafshan88@gmail.com
bazrafshan88@gmail.com 2016 年 12 月 8 日
コメント済み: zhoumu wu 2020 年 10 月 23 日
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 件のコメント
zhoumu wu
zhoumu wu 2020 年 10 月 23 日
sunaina2018-Calculating Numerical Derivatives using Fourier Transform some pitfalls and how to avoid them

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by