I couldn't help trying it myself 😉
Here is a method without using F and yext and without using matrix/vector operation which does the full 250001 points calculation in less than one second. I made Tsim an argument of the function and added prec (aka precision) as its last argument. prec is responsible for the time step width h = Ts / prec. So prec=200 gives you the result from your Matlab screenshot. lower values result in a larger step width and less precision. With the new function you may also try prec=400 (resulting in 500001 points) without having to wait long for the result.

Guess I was wrong with respect to the plot points limit. This seems only apply when plotting a function over a range. When plotting one vector over the other, this limit seems not to apply as I also could plot vectors with more than 2 millions points.
I ran into a strange effect (presumably round off errors when i tried to calculate the next time value using (i+1)*h. The values of iL were far off compared to the values calculated with the other methods (which resemble better the result of the MatLab calculation). Compare the two by changing the appropriate line in the program and decide yourself which result you may trust more - actually I am not really sure about it.
Here are the results which seem to match the Matlab results:

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.


