You’re doing implied multiplication (that MATLAB does not recognise), so it thinks you are addressing an array, and is throwing the error. I cannot read the reference you posted, so I also have to
Note that in the MathCad example, both‘Iav’ and‘mu’ are functions of several variables.
Your constants span a few orders of magnitude, so ifode45 gets stuck or gives strange results, see ifode15s will work.
Note — This isUNTESTED CODE so you may have to experiment with it to get it to work. My changes should at least solve some of your problems, and the revised code will not throw the error it did earlier.
Best Answer