"hold on" only has to with graphics routines.
When you have a "for" loop in which you are not using a reduction variable and you are not indexing the output, then each iteration of the "for" loop overwrites all of the output of the previous, giving a result that is the same as if only the last iteration had been run. Your
for N=1:10
Iapp=Io*(heaviside(20*N+2-t)-heaviside(20*N-t));
hold on
end
is the same as if you had written
for N=10
Iapp=Io*(heaviside(20*N+2-t)-heaviside(20*N-t));
end
Possibly you wanted
for N=1:10
Iapp(N)=Io*(heaviside(20*N+2-t)-heaviside(20*N-t));
end
but that would create a vector Iapp. I speculate that you want to sum all of them together,
dydt(1,1) = sum(Iapp)/C;
If so then you could write
N = 1 : 10;
Iapp = Io*(heaviside(20*N+2-t)-heaviside(20*N-t));
dydt(1,1) = sum(Iapp)/C;
with no loop.