Programming discrete fourier coefficients in matlab

1.6k Views Asked by At

Alright so I am having the following issue: I want to figure out how to find the fourier coefficients of the following function: $$D(X)=\frac {a'(x)} {1+a'(x)^2}$$

Where $a(x)$ is an arbitrary function. I already have a model for finding the fourier coefficients for $a(x)$ and $a'(x)$:

fc = fft(a) / Nfft;
fc = fftshift(fc);                % fft of a(x)
fc = conj(fc);                    % sign correction
aprimec = -i * [0:Dim2-1] .* fc;  % fc of derivative (definition)

The equation I am given to use is: $$f_m=\frac 1 N \sum^Nf_ie^{+im2\pi x}$$

Which confuses me because of the $f_i$. So does any one have any suggestions?

Additionally, I do not know how to define d

d = diff(a)/(1+diff(a)^2);

I do not think that this would work because doesn't diff(x) just take the difference between two consecutive components in the vector?

I would greatly appreciate any help. Thanks!

2

There are 2 best solutions below

2
On

You can try to approximate $D$ using the ifft of $a'$, additionally your formula seems to be $$ \hat{f}_m = \frac{1}{N} \sum_{j=0}^{N-1} f_j \omega_N^{mj} $$ where $\omega_N = \exp(\frac{2\pi i}{N})$.

0
On

The DFT is isomorphic, so if you have the DFT coefficients for $a'$, then all you need to do to get $a'$ is apply the inverse DFT:

D = ifft(aprimec) ./ (1 + ifft(aprimec).^2);