h[k_,r_,L_,nu_,a_,b_,m_,R_]:=(8/L^3)*(Abs[Sin[Pi*k*r/(19540.3(R))]])^3*(((L/2)*((Sqrt[2/Pi]*Abs[b]/(b^2+k^m)))^2*(Abs[(Sqrt[2/Pi]*Abs[a]/(a+k^m))]))/(Abs[k]+(((8*Pi^2*nu)/L)*Abs[k]^(7/3))+(((16*Pi^4*nu^2)/(L^2))*Abs[k]^(11/3)))+((Abs[(Sqrt[2/Pi]*Abs[a]/(a^2+k^m))])^3/(Abs[k]+(((12*Pi^2*nu)/L)*Abs[k]^(7/3))+(((48*Pi^4*nu^2)/(L^2))*Abs[k]^(11/3))+(((64*Pi^6*nu^3)/(L^3))*Abs[k]^5))))
(*This is the formula for the third structure function*)

v3=ReadList["C:\\Users\\John\\Desktop\\MPIDSReLambda110\\110AThirdStructureFunction.txt","Number"];
(*Data for third structure function*)

x=ReadList["C:\\Users\\John\\Desktop\\MPIDSRELambda264\\RoverEta.txt","Number"];
(*r/eta values*)

y3=v3/x;
(*Compensating by r^zeta_p yields better accuracy results for the fitting.  Thus, we divide the third structure function data by r, as zeta_3=1*)

u3=Transpose[{x,y3}];

q3=Transpose[{x,v3}];

FindFit[u3,(A1*Abs[Sin[Pi*r/(19540.3(1.56917))]]^3+A2*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^3+Sum[h[k,r,L,.00001546,11.6425,0.0161237,m,1.56917],{k,3,1000}])/r,{L,{m,1.3},A1,A2},r,MaxIterations->10000]
(*Here we fit to the third structure function*)

{L->1.4002225711926906`,m->1.4079545829778202`,A1->0.0015364993030136285`,A2->0.000871958092157627`

Show[LogLogPlot[(0.0015365*Abs[Sin[Pi*r/(19540.3(1.56917))]]^3+0.000871958*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^3+Sum[h[k,r,1.40022,.00001546,11.6425,0.0161237,1.40795,1.56917],{k,3,1000}]),{r,1.95403,Max[q3]},PlotRange->All,PlotStyle->{Red,Thick},TicksStyle->Larger],ListLogLogPlot[q3,PlotRange->All,PlotMarkers->{◇,20}]]
(*Here we plot the results of the third structure function fit against the data*)

g[k_,r_,L_,nu_,a_,b_,m_,R_]:=(4/L^2)*(((Abs[L]/2)*((Sqrt[2/Pi]*Abs[b]/(b^2+k^m))))/(Abs[k]^((2/3)-(4/9)+2(1-(2/3)^(2/3)))+((4*Pi^2*nu)/Abs[L])*Abs[k]^((2/3)-(4/9)+2(1-(2/3)^(2/3))+(4/3)))+(((Sqrt[2/Pi]*Abs[a]/(a^2+k^m)))^2/((Abs[k])^((2/3)-(4/9)+2(1-(2/3)^(2/3)))+((8*Pi^2*nu)/Abs[L])*(Abs[k]^((2/3)-(4/9)+2(1-(2/3)^(2/3))+(4/3)))+((16*Pi^4*nu^2)/L^2)*(Abs[k]^((2/3)-(4/9)+2(1-(2/3)^(2/3))+(8/3))))))*(Abs[Sin[Pi*k*r/(19540.3(R))]])^2
(*Second structure function formula*)

v2=ReadList["C:\\Users\\John\\Desktop\\MPIDSReLambda110\\110SecondStructureFunction.txt","Number"];
(*Data for second structure function*)

x=ReadList["C:\\Users\\John\\Desktop\\MPIDSRELambda264\\RoverEta.txt","Number"];

y2=v2/(x^((2/3)-(4/9)+2(1-(2/3)^(2/3))));
(*Compensating the second structure function by r^(zeta_2)*)

u2=Transpose[{x,y2}];

q2=Transpose[{x,v2}];

FindFit[u2,(A1*Abs[Sin[Pi*r/(19540.3(1.56917))]]^2+A2*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^2+Sum[g[k,r,L,.00001546,11.6425,0.0161237,m,1.56917],{k,3,1000}])/(r^((2/3)-(4/9)+2(1-(2/3)^(2/3)))),{L,{m,1.3},A1,A2},r,MaxIterations->10000]
(*Fitting the second structure function*)

Show[LogLogPlot[(0.00743913*Abs[Sin[Pi*r/(19540.3(1.56917))]]^2+0.00285281*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^2+Sum[g[k,r,2.79532,.00001546,11.6425,0.0161237,1.56268,1.56917],{k,3,1000}]),{r,1.95403,Max[q2]},PlotRange->All,PlotStyle->{Red,Thick},TicksStyle->Larger],ListLogLogPlot[q2,PlotRange->All,PlotMarkers->{◇,20}]]
(*Plot of the results of the second structure function fit against the data on a log-log scale*)

Show[Plot[(0.00743913*Abs[Sin[Pi*r/(19540.3(1.56917))]]^2+0.00285281*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^2+Sum[g[k,r,2.79532,.00001546,11.6425,0.0161237,1.56268,1.56917],{k,3,1000}]),{r,1.95403,Max[q2]},PlotRange->All,PlotStyle->{Red,Thick},TicksStyle->Larger],ListPlot[q2,PlotRange->All,PlotMarkers->{◇,20}]]
(*Plot of the results of the second structure function fit against the data on a normal scale*)

f[k_,r_,L_,nu_,a_,b_,m_,R_]:=(16/L^4)*(((L^2/4)*((Sqrt[2/Pi]*Abs[b]/(b^2+k^m)))^2)/(Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3)))+(8*Pi^2*nu/L)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+(4/3))+(16*Pi^4*nu^2/L^2)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+8/3))+((L/2)*((Sqrt[2/Pi]*Abs[b]/(b^2+k^m)))*Abs[Sqrt[2/Pi]*Abs[a]/(a^2+k^m)]^2)/(Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3)))+(12*Pi^2*nu/L)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+(4/3))+(48*Pi^4*nu^2/L^2)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+(8/3))+(64*Pi^6*nu^3/L^3)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+4))+(Abs[Sqrt[2/Pi]*Abs[a]/(a^2+k^m)])^4/(Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3)))+(16*Pi^2*nu/L)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+(4/3))+(96*Pi^4*nu^2/L^2)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+(8/3))+(256*Pi^6*nu^3/L^3)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+4)+(256*Pi^8*nu^4/L^4)*Abs[k]^((4/3)-(8/9)+2(1-(2/3)^(4/3))+(16/3))))*Abs[Sin[Pi*k*r/(19540.3(R))]]^4
(*Fourth structure function formula*)

v4=ReadList["C:\\Users\\John\\Desktop\\MPIDSReLambda110\\110FourthStructureFunction.txt","Number"];
(*Fourth structure function data*)

y4=v4/(x^((4/3)-(8/9)+2(1-(2/3)^(4/3))));
(*Compensating the fourth structure function*)

u4=Transpose[{x,y4}];

q4=Transpose[{x,v4}];

FindFit[u4,(A1*Abs[Sin[Pi*r/(19540.3(R))]]^4+A2*Abs[Sin[Pi*r*2/(19540.3(R))]]^4+Sum[f[k,r,L,.00001546,a,b,m,R],{k,3,1000}])/(r^((4/3)-(8/9)+2(1-(2/3)^(4/3)))),{{L,.5},{a,10},b,{m,1.3},{R,1.5},A1,A2},r,MaxIterations->10000]
(*Fitting the fourth structure function.  Note that this is where a,b, and R are set for the entire Taylor Reynolds number*)

Show[LogLogPlot[(0.000383851*Abs[Sin[Pi*r/(19540.3(1.56917))]]^4+0.000174405*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^4+Sum[f[k,r,1.0749,.00001546,11.6425,0.0161237,1.26897,1.56917],{k,3,1000}]),{r,1.95403,Max[q4]},PlotRange->All,PlotStyle->{Red,Thick},TicksStyle->Larger],ListLogLogPlot[q4,PlotRange->All,PlotMarkers->{◇,20}]]
(*Plot of the results of the fourth structure function fit against the data on a log-log scale*)

p[k_,r_,L_,nu_,a_,b_,m_,R_]:=(2/L)^6*((8/L^3)*(((Sqrt[2/Pi]*Abs[b]/(b^2+k^m))^3)/(Abs[k]^(2-(12/9)+2(1-(2/3)^2))+(12*Pi^2*nu/L)*Abs[k]^((2-(12/9)+2(1-(2/3)^2))+(4/3))+(48*Pi^4*nu^2/L^2)*Abs[k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2/3)^2))+(16/3))+(6144*Pi^10*nu^5/L^5)*Abs[k]^((2-(12/9)+2(1-(2/3)^2))+(20/3))+(4096*Pi^12*nu^6/L^6)*Abs[k]^((2-(12/9)+2(1-(2/3)^2))+8)))))*Abs[Sin[Pi*k*r/(19540.3(R))]]^6
(*Sixth structure function formula*)

v6=ReadList["C:\\Users\\John\\Desktop\\MPIDSReLambda110\\110SixthStructureFunction.txt","Number"];
(*Sixth structure function data*)

x=ReadList["C:\\Users\\John\\Desktop\\MPIDSRELambda264\\RoverEta.txt","Number"];

y6=v6/(x^((6/3)-(12/9)+2(1-(2/3)^(6/3))));
(*Compensating the sixth structure function*)

u6=Transpose[{x,y6}];

q6=Transpose[{x,v6}];

FindFit[u6,(A1*Abs[Sin[Pi*r/(19540.3(1.56917))]]^6+A2*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^6+Sum[p[k,r,L,.00001546,11.6425,0.0161237,m,1.56917],{k,3,1000}])/(r^((6/3)-(12/9)+2(1-(2/3)^(6/3)))),{L,{m,1.3},A1,A2},r,MaxIterations->10000]
(*Fitting the sixth structure function*)

Show[LogLogPlot[(0.0000341082*Abs[Sin[Pi*r/(19540.3(1.56917))]]^6+4.23641*(10^(-6))*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^6+Sum[p[k,r,1.15286,.00001546,11.6425,0.0161237,.986067,1.56917],{k,3,1000}]),{r,1.95403,Max[q6]},PlotRange->All,PlotStyle->{Red,Thick},TicksStyle->Larger],ListLogLogPlot[q6,PlotRange->All,PlotMarkers->{◇,20}]]
(*Plot of the results of the sixth structure function fit against the data on a log-log scale*)

q[k_,r_,L_,nu_,a_,b_,m_,R_]:=(2/L)^8*((((L^4/16)*(Sqrt[2/Pi]*Abs[b]/(b^2+k^m))^4/(Abs[k]^((8/3)-(16/9)+2(1-(2/3)^(8/3)))+(16*Pi^2*nu/L)*Abs[k]^((8/3)-(16/9)+2(1-(2/3)^(8/3))+(4/3))+(96*Pi^4*nu^2/L^2)*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*nu^8/L^8)*Abs[k]^((8/3)-(16/9)+2(1-(2/3)^(8/3))+(32/3)))))*Abs[Sin[Pi*k*r/(19540.3(R))]]^8
(*Eighth structure function formula*)

v8=ReadList["C:\\Users\\John\\Desktop\\MPIDSReLambda110\\110EighthStructureFunction.txt","Number"];
(*Eighth structure function data*)

x=ReadList["C:\\Users\\John\\Desktop\\MPIDSRELambda264\\RoverEta.txt","Number"];

y8=v8/(x^((8/3)-(16/9)+2(1-(2/3)^(8/3))));
(*Compensating the eighth structure function*)

u8=Transpose[{x,y8}];

p8=Transpose[{x,v8}];

FindFit[u8,(A1*Abs[Sin[Pi*r/(19540.3(1.56917))]]^8+A2*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^8+Sum[q[k,r,L,.00001546,11.6425,0.0161237,m,1.56917],{k,3,1000}])/(r^((8/3)-(16/9)+2(1-(2/3)^(8/3)))),{{L,0.1},{m,0.75},A1,A2},r,MaxIterations->10000]
(*Fitting the eighth structure function*)

Show[LogLogPlot[(3.11806*10^(-6)*Abs[Sin[Pi*r/(19540.3(1.56917))]]^8+1.03704*10^(-6)*Abs[Sin[Pi*r*2/(19540.3(1.56917))]]^8+Sum[q[k,r,.615824,.00001546,11.6425,0.0161237,.971146,1.56917],{k,3,1000}]),{r,1.95403,Max[p8]},PlotRange->All,PlotStyle->{Red,Thick},TicksStyle->Larger],ListLogLogPlot[p8,PlotRange->All,PlotMarkers->{◇,20}]]
(*Plot of the results of the eighth structure function fit against the data on a log-log scale*)