Hi, I have a code to import data from txt file which is list of some numbers like below:
6.6451
7.5027
7.4628
5.7056
3.0588
...
Code:
SetDirectory["E:\\Studia\\Magisterskie\\Magisterka"];
dat = Import["DM.txt"];
i = 2;
While[i <= Length[dat], aa = Table[dat[[k]], {k, 1, i}];
mean[i] = 1/Length[aa]*Sum[aa[[k]], {k, 1, Length[aa]}];
var[i] =
1/(Length[aa] - 1)*Sum[(aa[[k]] - mean[i])^2, {k, 1, Length[aa]}];
n5[i] = 1.96^2*var[i]/(mean[i]*0.05)^2; i++];
bbb = Table[{i, mean[i][[1]]}, {i, 2, Length[dat]}];
PL = ListPlot[bbb, Joined -> True];
ddd = Table[{i, var[i][[1]]}, {i, 2, Length[dat]}];
PL5 = ListPlot[ddd, Joined -> True];
eee = Table[{i, dat[[i]][[1]]}, {i, 1, Length[dat]}];
PL0 = ListPlot[eee, Joined -> False];
f = mean[Length[dat]];
g = mean[Length[dat]][[1]] + 1*Sqrt[var[Length[dat]][[1]]];
h = mean[Length[dat]][[1]] - 1*Sqrt[var[length[dat]][[1]]];
v = var[Length[dat]];
PL1 = Plot[f, {x, 1, Length[dat]}, PlotStyle -> Black];
PL2 = Plot[g, {x, 1, Length[dat]}, PlotStyle -> {Red, Dashed}];
PL3 = Plot[h, {x, 1, Length[dat]}, PlotStyle -> {Green, Dashed}];
PL4 = Plot[v, {x, 1, Length[dat]}, PlotStyle -> Black];
xy = Show[{PL, PL1}, AxesLabel -> {"Liczba próbek", "?rednia E [GPa]"}]
Export["xy.jpg", xy, ImageResolution -> 500];
xyz = Show[{PL0, PL1, PL2, PL3},
AxesLabel -> {"Liczba próbek", "E [GPa]"}]
Export["xyz.jpg", xyz, ImageResolution -> 500];
xyzz = Show[{PL4, PL5},
AxesLabel -> {"Liczba próbek", "wariancja E [GPa]"}]
Export["xyzz.jpg", xyzz, ImageResolution -> 500];
n = n5[Length[dat]];
i = 0;
new = {};
Label[begin]; i = i + 1; If[i <= Length[dat], Goto[further],
Goto[end]];
Label[further]; If[h <= dat[[i]][[1]] <= g, Goto[next],
Goto[begin]]; Label[next]; new =
Join[new, {dat[[i]][[1]]}]; Goto[begin]; Label[end];
PL00 = ListPlot[new];
ff = Mean[new];
PL11 = Plot[ff, {x, 1, Length[new]}, PlotStyle -> Black];
PL22 = Plot[g, {x, 1, Length[new]}, PlotStyle -> {Red, Dashed}];
PL33 = Plot[h, {x, 1, Length[new]}, PlotStyle -> {Green, Dashed}];
xyz1 = Show[{PL00, PL11, PL22, PL33}]
Print["?redni modu? Younga= ", f, " GPa"]
Print["Wariancja= ", v, " GPa"]
Print["Liczba próbek= ", n]
Print["?redni modu? Younga= ", Mean[new], " GPa"]
Print["Wariancja= ", Variance[new], " GPa"]
Print["Liczba próbek= ", 1.96^2*Variance[new]/(Mean[new]*0.05)^2]
I tried to execute that code but then there is an error:
ListPlot::argx: ListPlot called with 0 arguments; 1 argument is expected. >>
ListPlot::argx: ListPlot called with 0 arguments; 1 argument is expected. >>
ListPlot::argx: ListPlot called with 0 arguments; 1 argument is expected. >>
**And much more errors due to this 3. It's something with the creation of the tables from the file i think, but i don't know what. Should I edit txt file somehow or there is something in the code to be fixed - code is not originally mine and I am kind of green with Wolfram.**
Please help me :)
Attachments: