clear;
chaos1_1=csvread('result.txt');
chaos1_2=csvread('result_trial_2.txt');
sa_1=csvread('result_sa.txt');
sa_2=csvread('result_sa_trial_2.txt');
chaos2_1=csvread('result_2.txt');
chaos2_2=csvread('result_2_trial_2.txt');

num_steps = 400;

%find a value of n that is the closest power of 2 to the number of samples
n = pow2(nextpow2(num_steps)); 

% calculate the fft of the x component
x_fft = fft(chaos2_2,n)/num_steps;
% determine the sampling frequency
fs = 1;
% generate the frequecy vector, where each step is the sampling frequency
f = (0:n-1)*(fs/n);
% calculate the power spectrum (in dB)
power = 10*log10((abs(x_fft).^2));
% calculate the amplitude spectrum
amplitude = 2*abs(x_fft);
% calculate the phase of the spectrum
phase = angle(x_fft);

% plot the amplitude, phase, and power
figure;
%plot(f, amplitude)
%figure;
plot(f, phase)
%figure;
%plot(f, power)
%figure;
%this is the log-log plot of the power
%plot(log10(f), power/10)
