how to change a matrix variable for each iteration of a matrix loop?
1 view (last 30 days)
Christiaan on 1 Apr 2015
Assuming that you use a ODE solver like ode 45, and you have a time dependent variable, please have a loop at this MATHWORKS answer.
If you use a for loop for your iterations, and the variable that depends on time, is an input parameter, you can first make a function that specifies the time-dependent parameter at any time. Then you can call the function in the for loop and assign this value in your matrix. A second possibility is to first make an array of that parameter (first row the time, and second row the parameter) and then use an interpolation function (i.e. pchip) to use the correct value of that parameter to update your matrix.
Good Luck! Christiaan