ode45 with a array of vector
Show older comments
I am solving 6 ODEs simultaneously. My eqns are:
eq1 = diff(x,t) == u1+vp.*p1 ;
eq2 = diff(y,t) == u2+vp.*p2 ;
eq3 = diff(z,t) == u3+vp.*p3 ;
eq1 = diff(p1,t) == a1*p1+a2*p2+a3*p3 ;
eq2 = diff(p2,t) == b1*p1+b2*p2+b3*p3 ;
eq3 = diff(p3,t) == c1*p1+c2*p2+c3*p3 ;
Here, a1, a2, a3, b1, b2 b3, c1, c2, c3 and vp are constants.
u1, u2, and u3 are vector of dimension [1 X 100]. Each values of u1, u2, and u3 corresponds to time points in tValues = linspace(0,10,100). I want to compute p1, p2, p3 and x, y, z for tValues = linspace(0,10,100).
My code is following: ;
vars = [x(t); z(t); y(t); p1(t); p2(t); p3(t)];
V = odeToVectorField([eq2 eq1 eq3 eq4 eq5 eq6]);
M = matlabFunction(V,'vars', {'t','Y'});
y0=[0 0 0 p1_0 p2_0 p3_0];
ySol_a = ode45(M,interval,y0);
Once the code is run, it shows following error message:
MuPAD error: Error: Cannot convert the initial value problem to an equivalent dynamical system. Either the differential equations cannot be solved for the highest derivatives or inappropriate initial conditions were specified. [numeric::ode2vectorfield]
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!