Viewing a single comment thread. View all comments

TaliskerBay22 t1_j5w0hju wrote

Look here is an example, the time domain lasts for a ms and the Fourier response extends from 0 to some tens of KHz. Plug it in Matlab and tweak it as you like

% Define time-domain signal
dt = 0.000001; % time step (s)
t = 0:dt:0.001; % time vector (s)
x = cos(50000.*t-0.0004).*exp(-(t-0.0003).^2/0.00006^2); % time-domain signal
% Perform FFT
X = fft(x); % FFT of time-domain signal
f = (0:length(X)-1)/(dt*length(X)); % frequency vector (Hz)
% Plot results
figure;
subplot(2,1,1);
plot(t,x);
xlabel('Time (s)');
ylabel('Amplitude');
title('Time-domain signal');
subplot(2,1,2);
Amplitude=abs(X);
semilogy(f(1:length(X)/20),Amplitude(1:length(X)/20));
xlabel('Frequency (Hz)');
ylabel('Amplitude');
title('Frequency-domain signal (FFT)');

4