function filecontent = importfile(filename, startRow, endRow)
delimiter = '\t';
if nargin<=2
startRow = 1;
endRow = inf;
end
formatSpec = '%f%f%f%f%f%f%f%f%f%f%f%[^\n\r]';
fileID = fopen(filename,'r');
dataArray = textscan(fileID, formatSpec, endRow(1)-startRow(1)+1, 'Delimiter', delimiter, 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines', startRow(1)-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
for block=2:length(startRow)
frewind(fileID);
dataArrayBlock = textscan(fileID, formatSpec, endRow(block)-startRow(block)+1, 'Delimiter', delimiter, 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines', startRow(block)-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
for col=1:length(dataArray)
dataArray{col} = [dataArray{col};dataArrayBlock{col}];
end
end
fclose(fileID);
filecontent = [dataArray{1:end-1}];
timestep = filecontent(:,1);
x=zeros(length(timestep),1);
y=zeros(length(timestep),1);
z=zeros(length(timestep),1);
for j =1:length(timestep)
x(j) =((filecontent(j,5)+filecontent(j,6))-(filecontent(j,4)+filecontent(j,7)))/sum(filecontent(j,4:7));
y(j) =((filecontent(j,6)+filecontent(j,7))-(filecontent(j,4)+filecontent(j,6)))/sum(filecontent(j,4:7));
z(j)= abs(x(j)+y(j)*1i);
end
TimserisData =[x y z];
Data =TimserisData(:,3);
Fs =1000;
T=1/Fs;
N =length(TimserisData(:,3));
t=(0:N-1)*T;
NFFT=2^nextpow2(N);
X=fft(Data,NFFT)/N;
f = Fs/2*linspace(0,1,NFFT/2+1);
figure
loglog(f,2*abs(X(1:NFFT/2+1)))
xlabel('Frequency (Hz)')
ylabel('|p(f)|[a.u]')