I am a python (and numpy) regular who just started using Matlab. I am solving boundary value problems using bv4pc
, and I want to store the result arrays, solved for different parameters, in a larger array.
For example, consider the following code that returns a result vector y
for each value of the parameter t
-
for j = 1:loops
t = 1/(sqrt(2).^j)
% solve ODE that depends on parameter t
sol = bvp4c(@(x,y)elasticaODE(x,y,t),@(ya,yb)elasticaBC(ya,yb,t),solinit,options);
% The solution at the mesh points
x = sol.x;
y = sol.y;
In python, I would just do:
yVector = []
for (t in tArray):
... solve ODE, get y ...
yVector.append(y)
yVector = np.array(yVector)
What is the equivalent in Matlab?