Using fft and ifft with less frequencies than input points
I want to use fft and ifft in the context of heat equation. Therefore the grid needs to be refined, but I dont want to use as many coefficients in the fft:
%Grid
Nx = 10001;
dx = L/(Nx-1);
x = linspace(0,L,Nx)’;
%Function
f = @(x) rectangularPulse(0.5, 1.5, x);
f_values = arrayfun(f,x);
u0 = ifft(fft(f_values)); %Takes very long
What I would want to do, is to insert an N, f.e. N=100, but get an array 10001×1.
Thanks.I want to use fft and ifft in the context of heat equation. Therefore the grid needs to be refined, but I dont want to use as many coefficients in the fft:
%Grid
Nx = 10001;
dx = L/(Nx-1);
x = linspace(0,L,Nx)’;
%Function
f = @(x) rectangularPulse(0.5, 1.5, x);
f_values = arrayfun(f,x);
u0 = ifft(fft(f_values)); %Takes very long
What I would want to do, is to insert an N, f.e. N=100, but get an array 10001×1.
Thanks. I want to use fft and ifft in the context of heat equation. Therefore the grid needs to be refined, but I dont want to use as many coefficients in the fft:
%Grid
Nx = 10001;
dx = L/(Nx-1);
x = linspace(0,L,Nx)’;
%Function
f = @(x) rectangularPulse(0.5, 1.5, x);
f_values = arrayfun(f,x);
u0 = ifft(fft(f_values)); %Takes very long
What I would want to do, is to insert an N, f.e. N=100, but get an array 10001×1.
Thanks. fft, ode MATLAB Answers — New Questions