Hi, allow me be a bother one more time. Am really grateful for the assistance have recieved from this community so far. With the help from you have been able to debug most of my codes. The code is working very well for certain values but bad things happen when I reduce the interval between data. To understand my question consider the below code. if I let t=[0:1:30], with r=0.1 and T=5, the code reurns correct values. Se the attached graph and the code attached. However, any attmept to make any changes to the inputs, like reducing the time steps maybe to 0.1 so that t=[0:0.1:30], some other zeros appear whiich i really don't expect. See the second figure. What might be causing this? Have reviewed te equation and am certain, the equations are correct. Is there a trick I can use to avoid such?
Have also found out that Matlab is skeeping certain value of t, for example the fisrt unnecesary zero occur at t=0.6, t=0.7...upto t=0.9, then at t=1.0 and t=1.1, the correct output is given, then aftert  that another set of zeros are the output. Why is the code behaving this way
r=input('Enter the radius of each electron\n');
R=input('Enter the the radius of the electron path\n');
T=input('Input the desire period\n');
    m1=n*abs(sin(pi*t(i)/T));
        m=1:1:fix((m1*r)/(2*r*cos(pi/6)));
            f1(j,1)=fix(m1*2*sin(acos((m(j)*sqrt(3)/m1))));
                f10=m1*2*sin(acos((mmax*sqrt(3)/m1)));
                    Na=1:1:((fix(f10/2)-2)/2);
                    for a=1:1:((fix(f10/2)-2)/2)
                        f13(a,1)=2*fix(2*((m1*r*sin(acos((2*r*Na(a))/(m1*r))))-(2*mmax*r*cos(pi/6)))/r);
                            f14=2*fix(2*((m1*r*sin(acos((r)/(m1*r))))-(2*mmax*r*cos(pi/6)))/r);
                            f15=fix(m1)+f14+sum(f13(1:a));
                    Nb=1:1:((fix(f10/2)-1)/2);
                    for b=1:1:((fix(f10/2)-1)/2)
                        f16(b,1)=2*fix(2*((m1*r*sin(acos((2*r*Nb(b))/(m1*r))))-(2*mmax*r*cos(pi/6)))/r);
                            f17=fix(2*((m1*r)-(2*mmax*r*cos(pi/6)))/r);
                            f18=fix(m1)+f17+sum(f16(1:b));
The first figure and results when t=[0:1:30] which is correct
f0 =
     0
   118
   319
   319
   118
     0
   118
   319
   319
   118
     0
   118
   319
   319
   118
     0
   118
   319
   319
   118
     0
   118
   319
   319
   118
     0
   118
   319
   319
   118
     0
>> 
This is the sceond figure when time step is reduced to 0.1 so that t=[0:0.1:30]'
f0 =
     0
     1
     3
     8
    20
    30
     0
     0
     0
     0
   118
   138
     0
     0
     0
     0
     0
     0
   286
     0
   319
   331
     0
   345
   348
     0
   348
   345
     0
   331
   319
     0
   286
     0
     0
     0
     0
     0
     0
   138
   118
     0
     0
     0
     0
    30
    20
     8
     3
     1
     0
     1
     3
     8
    20
    30
     0
     0
     0
     0
   118
   138
     0
     0
     0
     0
     0
     0
   286
     0
   319
   331
     0
   345
   348
     0
   348
   345
     0
   331
   319
     0
   286
     0
     0
     0
     0
     0
     0
   138
   118
     0
     0
     0
     0
    30
    20
     8
     3
     1
     0
     1
     3
     8
    20
    30
     0
     0
     0
     0
   118
   138
     0
     0
     0
     0
     0
     0
   286
     0
   319
   331
     0
   345
   348
     0
   348
   345
     0
   331
   319
     0
   286
     0
     0
     0
     0
     0
     0
   138
   118
     0
     0
     0
     0
    30
    20
     8
     3
     1
     0
     1
     3
     8
    20
    30
     0
     0
     0
     0
   118
   138
     0
     0
     0
     0
     0
     0
   286
     0
   319
   331
     0
   345
   348
     0
   348
   345
     0
   331
   319
     0
   286
     0
     0
     0
     0
     0
     0
   138
   118
     0
     0
     0
     0
    30
    20
     8
     3
     1
     0
     1
     3
     8
    20
    30
     0
     0
     0
     0
   118
   138
     0
     0
     0
     0
     0
     0
   286
     0
   319
   331
     0
   345
   348
     0
   348
   345
     0
   331
   319
     0
   286
     0
     0
     0
     0
     0
     0
   138
   118
     0
     0
     0
     0
    30
    20
     8
     3
     1
     0
     1
     3
     8
    20
    30
     0
     0
     0
     0
   118
   138
     0
     0
     0
     0
     0
     0
   286
     0
   319
   331
     0
   345
   348
     0
   348
   345
     0
   331
   319
     0
   286
     0
     0
     0
     0
     0
     0
   138
   118
     0
     0
     0
     0
    30
    20
     8
     3
     1
     0