Weird bugs when solving three coupled second order differential equations using ode45
Hi guys, I am new to ode45 so I am very confused about its results. I have good results when solving two coupled differential equations (say, x1 and y ), but when I add one more equation (say x2), then the results are very different and even if I set x2 equation the same as x1, which doesn’t make much sense for me. Here are the codes I used:
eq1 = diff(x1,2) == -2*gamma_ir*omega_ir1*dx1 – omega_ir1^2*x1 + y + 2*x2*y;
eq2 = diff(x2,2) == -2*gamma_ir*omega_ir2*dx2 – omega_ir2^2*x2 + y + 2*x1*y;
eq3 = diff(y,2) == -2*gamma_r*omega_r*dy – omega_r^2*y + x1*x2;
V = odeToVectorField(eq1,eq2,eq3);
M = matlabFunction(V,’vars’, {‘t’,’Y’});
interval = t0;
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),tNum);
sol = deval(ySol,tValues,3);
Thanks in advance!Hi guys, I am new to ode45 so I am very confused about its results. I have good results when solving two coupled differential equations (say, x1 and y ), but when I add one more equation (say x2), then the results are very different and even if I set x2 equation the same as x1, which doesn’t make much sense for me. Here are the codes I used:
eq1 = diff(x1,2) == -2*gamma_ir*omega_ir1*dx1 – omega_ir1^2*x1 + y + 2*x2*y;
eq2 = diff(x2,2) == -2*gamma_ir*omega_ir2*dx2 – omega_ir2^2*x2 + y + 2*x1*y;
eq3 = diff(y,2) == -2*gamma_r*omega_r*dy – omega_r^2*y + x1*x2;
V = odeToVectorField(eq1,eq2,eq3);
M = matlabFunction(V,’vars’, {‘t’,’Y’});
interval = t0;
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),tNum);
sol = deval(ySol,tValues,3);
Thanks in advance! Hi guys, I am new to ode45 so I am very confused about its results. I have good results when solving two coupled differential equations (say, x1 and y ), but when I add one more equation (say x2), then the results are very different and even if I set x2 equation the same as x1, which doesn’t make much sense for me. Here are the codes I used:
eq1 = diff(x1,2) == -2*gamma_ir*omega_ir1*dx1 – omega_ir1^2*x1 + y + 2*x2*y;
eq2 = diff(x2,2) == -2*gamma_ir*omega_ir2*dx2 – omega_ir2^2*x2 + y + 2*x1*y;
eq3 = diff(y,2) == -2*gamma_r*omega_r*dy – omega_r^2*y + x1*x2;
V = odeToVectorField(eq1,eq2,eq3);
M = matlabFunction(V,’vars’, {‘t’,’Y’});
interval = t0;
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),tNum);
sol = deval(ySol,tValues,3);
Thanks in advance! differential equations, ode45 MATLAB Answers — New Questions