You used For
when it would be more natural to use Table
(or some other table-like function, and see my other comment about replacing Table
with Transpose
). Let's say can specify your sample points with an iteration expression and you want to apply a function to those points:
Table[myFunction[i], {i, 0.1, 0.3, 0.05}]
(* {myFunction[0.1], myFunction[0.15], myFunction[0.2], myFunction[0.25], myFunction[0.3]} *)
Array[myFunction, 5, {0.1, 0.3}]
(* {myFunction[0.1], myFunction[0.15], myFunction[0.2], myFunction[0.25], myFunction[0.3]} *)
Or let's say you have the sample points in a list, then you can just map over the list:
samplePointsFromSomewhere = Range[.1, .3, .05];
myFunction /@ samplePointsFromSomewhere
(* {myFunction[0.1], myFunction[0.15], myFunction[0.2], myFunction[0.25], myFunction[0.3]} *)
Now, for the specific case of h2
where you just need to generate those sample points, you did this:
h2 = {};
For[jf = 0.001, jf <= 0.30, jf += 0.00005, s = jf; AppendTo[h2, s]];
But it would be much clearer and cleaner (and probably faster) to do this:
h2 = Range[.001, .3, .00005];