# How to create list

I have a law under which the current changes, and i need to find values of current evry f sec. Code is:

Alpha = 0.0051;
Irf[t_, T_] := If[t <= T, Alpha*t, 2*T*Alpha - Alpha*t]*Milli Ampere
Period := 50/2;
Plot[Irf[t, Period]/(Milli Ampere), {t, 0, 2 Period},
AxesLabel -> {t, Subscript[I, rf]}]

t1 = 0;
t2 = 25;
f = 5;(*time goes from t1 to t2 in steps of 1*)

k = For[i = 0; t = x, i*f <= Period, i++, t = Alpha*(i*f); Print[t]]


As a result I have current values ​​corresponding to a certain time which are written into the column, as it is possible to write them in a row and create a list.

That's what i have:

0.

0.0255

0.051

0.0765

0.102

0.1275


And I want it to look like this: {0., 0.0255, 0.051, 0.0765, 0.102, 0.1275}

• Use Table not For. – Kuba Mar 20 '17 at 22:27
• Irf[#, Period]/(Milli Ampere) & /@ Range[t1, t2, f] – bienti Mar 21 '17 at 9:40

Alpha = 0.0051;
list={};
Irf[t_, T_] := If[t <= T, Alpha*t, 2*T*Alpha - Alpha*t]*Milli Ampere
Period := 50/2;
Plot[Irf[t, Period]/(Milli Ampere), {t, 0, 2 Period},
AxesLabel -> {t, Subscript[I, rf]}]

t1 = 0;
t2 = 25;
f = 5;(*time goes from t1 to t2 in steps of 1*)

k = For[i = 0; t = x, i*f <= Period, i++, t = Alpha*(i*f);AppendTo[list,t]];
list