Using MATLAB I want to implement some kind of a spectral method. The idea is as following (described for a example which is working).
Dirichlet (and Neumann, and periodic) boundaries leads to eigenvalues in the fourier space of
k=n*pi/L
Projecting all the linear operators in the fourier space to the discretized k-values:
e.g.
L = -D*(k.*k)
(for diffusion only)Defining the propagator in time as
P = exp( dt * L )
Calculating iteratively the evolution in time by
uh_{n+1} = uh_n * P
return the calculated value to the real space every time I want to save the value by
ifft( uh )
My question concerns another boundary conditions.
In my case I have Robin boundary conditions. So, the eigenvalues are defined through some weird equation of the form tan( x ) = x
or the like. The problem of computing them is solved.
As I have the values, the step no. 2 and 3 is simple too, but:
For applying P
on the fourier-transformed vector uh
I have to ensure that my uh = fft(u)
uses the same eigenvalues, which is not the case by default.
By default MATLAB uses equidistant modes for the fft.
Is there any simple trick for this?
Or, maybe, do I have any mistake in my thoughts?