function lyapunov(filename) %This function will plot a set of data, measure it's %Fast Fourier Transfor, and find the Lyapunov and the %Correlation Dimension for the set. % load in data file data = load(filename); % calculate number of data points N = length(data); % create another array for return map nextdata = zeros(N,1); for (i=1:N-1) nextdata(i)=data(i+1); end nextdata(N)=nextdata(N-1); % now plot it (except last point) plot(data(1:N-1),nextdata(1:N-1),'.'); % give it a title title(['Return map; Data = ', filename ]); %save jpeg name = [ filename,'_return.jpg']; print ('-djpeg(100)', name) % Pause and wait for user input ... display('press any key to continue'); pause; % calculate the fast fourier transform fftcoeff = fft(data,N); t = 2:N; % plot the absolute value fourier coefficients plot(t,abs(fftcoeff(2:N))); % give it a title title(['Fourier Coefficients; Data = ', filename ]); %save jpeg name = [ filename,'_fast_fourier_coeff.jpg']; print ('-djpeg(100)', name) % Pause and wait for user input display('press any key to continue'); pause; N2 = floor(N/2); N4 = floor(N/4); % find mid point of orbit sequence k=N2; % create space for exponents exponent = zeros(N4,1); % look at 1/4 of the points for (j=1:N4) % set distance initially d = abs(data(k+1)-data(k)); index = k+1; for (i=2:N-1) % see if there is a closer point if (i ~= k) && (abs(data(i)-data(k)))