2 corrected error.
source | link

Generally, you don't need nearly so many points to get a nice fit. Regardless, we can use NonlinearModelFit[] to get what you want:

You can use Drop[list,n] to drop the first n elements of a list.

dir = NotebookDirectory[];
SetDirectory[dir];
file = "ss.dat";

d = Import[file];
T = Table[d[[1, i]], {i, 8001Drop[Flatten[d], 10000}];8000];
St = Drop[Take[T, {1, -1, 1}], 0];
Stt = Table[{i, T[[i]]}, {i, 1, Length[St]}];
e = NonlinearModelFit[Stt, a*E^(-b*x), {a, b}, x]
e["BestFitParameters"]


GraphicsGrid[{{ListPlot[Stt, ImageSize -> Medium, PlotRange -> All, PlotTheme -> "Scientific"], Plot[{Evaluate[a*E^(-b*x) /. e["BestFitParameters"]]}, {x, 0,Length[Stt]}, PlotTheme -> "Scientific", Epilog -> {Red, Point[Stt]}]}}]

plots

Using the code will drop every x elements from your entire list, drastically reducing your plot points. 2000, or even 10000 are just not needed.

St = Drop[Take[T, {1, -1, 1}], 0];

and changing to:

St = Drop[Take[T, {1, -1, 40}], 0];

Gives us:

plot2

A nice visual that the points lay directly on our function, and a good fit for a and b.

Generally, you don't need nearly so many points to get a nice fit. Regardless, we can use NonlinearModelFit[] to get what you want:

dir = NotebookDirectory[];
SetDirectory[dir];
file = "ss.dat";

d = Import[file];
T = Table[d[[1, i]], {i, 8001, 10000}];
St = Drop[Take[T, {1, -1, 1}], 0];
Stt = Table[{i, T[[i]]}, {i, 1, Length[St]}];
e = NonlinearModelFit[Stt, a*E^(-b*x), {a, b}, x]
e["BestFitParameters"]


GraphicsGrid[{{ListPlot[Stt, ImageSize -> Medium, PlotRange -> All, PlotTheme -> "Scientific"], Plot[{Evaluate[a*E^(-b*x) /. e["BestFitParameters"]]}, {x, 0,Length[Stt]}, PlotTheme -> "Scientific", Epilog -> {Red, Point[Stt]}]}}]

plots

Using the code

St = Drop[Take[T, {1, -1, 1}], 0];

and changing to:

St = Drop[Take[T, {1, -1, 40}], 0];

Gives us:

plot2

A nice visual that the points lay directly on our function, and a good fit for a and b.

Generally, you don't need nearly so many points to get a nice fit. Regardless, we can use NonlinearModelFit[] to get what you want:

You can use Drop[list,n] to drop the first n elements of a list.

dir = NotebookDirectory[];
SetDirectory[dir];
file = "ss.dat";

d = Import[file];
T = Drop[Flatten[d], 8000];
St = Drop[Take[T, {1, -1, 1}], 0];
Stt = Table[{i, T[[i]]}, {i, 1, Length[St]}];
e = NonlinearModelFit[Stt, a*E^(-b*x), {a, b}, x]
e["BestFitParameters"]


GraphicsGrid[{{ListPlot[Stt, ImageSize -> Medium, PlotRange -> All, PlotTheme -> "Scientific"], Plot[{Evaluate[a*E^(-b*x) /. e["BestFitParameters"]]}, {x, 0,Length[Stt]}, PlotTheme -> "Scientific", Epilog -> {Red, Point[Stt]}]}}]

plots

Using the code will drop every x elements from your entire list, drastically reducing your plot points. 2000, or even 10000 are just not needed.

St = Drop[Take[T, {1, -1, 1}], 0];

and changing to:

St = Drop[Take[T, {1, -1, 40}], 0];

Gives us:

plot2

A nice visual that the points lay directly on our function, and a good fit for a and b.

1
source | link

Generally, you don't need nearly so many points to get a nice fit. Regardless, we can use NonlinearModelFit[] to get what you want:

dir = NotebookDirectory[];
SetDirectory[dir];
file = "ss.dat";

d = Import[file];
T = Table[d[[1, i]], {i, 8001, 10000}];
St = Drop[Take[T, {1, -1, 1}], 0];
Stt = Table[{i, T[[i]]}, {i, 1, Length[St]}];
e = NonlinearModelFit[Stt, a*E^(-b*x), {a, b}, x]
e["BestFitParameters"]


GraphicsGrid[{{ListPlot[Stt, ImageSize -> Medium, PlotRange -> All, PlotTheme -> "Scientific"], Plot[{Evaluate[a*E^(-b*x) /. e["BestFitParameters"]]}, {x, 0,Length[Stt]}, PlotTheme -> "Scientific", Epilog -> {Red, Point[Stt]}]}}]

plots

Using the code

St = Drop[Take[T, {1, -1, 1}], 0];

and changing to:

St = Drop[Take[T, {1, -1, 40}], 0];

Gives us:

plot2

A nice visual that the points lay directly on our function, and a good fit for a and b.