Script for Fast Fourier Transformation
Conversion of available experimental data from time domain to frequency domain.
Clearing workspace and command window-
clear;
clc;
Importing data.csv-
data = readtable("data.csv");
Spliting into vectors-
time = data{:,1};
V = data{:,2};
Determining dt, length of the vectors and sampling frequency-
l1 = length(V);
dt = (time(end)-time(1))/(l1-1);
fs = 1/dt;
FFT-
fft_V = fft(V, l1)*(2/l1);
abs_V = abs(fft_V);
freq = 0:(1/time(end)):fs/2-(1/time(end));
Ploting raw data (Given in time domain)-
plot(time, V)
xlabel('Time')
xlim([0 125])
ylabel('Heat Flux')
ylim([-10 50])
grid on
Ploting FFT-
figure
plot(freq, abs_V(1:length(freq)))
xlabel('Frequency')
ylim([-10 110])
xlim([-0.025 0.1])
grid on