Error message: Invalid index.
Show older comments
Hi everyone, I am trying to solve two second order differential equations with two unknowns. However, matlab gives the warning that:
" Warning: Number of equations greater than number of indeterminates. Trying heuristics to reduce to square system.
> In symengine
In mupadengine/evalin (line 123)
In mupadengine/feval (line 182)
In dsolve>mupadDsolve (line 340)
In dsolve (line 194)
In InvalidIndexError (line 34)"
Then it later gives an error that:
" Error using mupadengine/feval (line 187)
Invalid index.
Error in dsolve>mupadDsolve (line 340)
T = feval(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 194)
sol = mupadDsolve(args, options);
Error in InvalidIndexError (line 34)
[aSol, bSol] = dsolve(odes,bc)".
What can I do? Please see the code below and on the attachment:
syms A B C E F G H I J K N O P a(x) b(x)
%%Parameters
A = 3.22e-9;
B = 2.13e-9;
C = 1.28e-9;
E = 1.66e-8;
F = 8.06e-9;
G = 8.14e-5;
H = 149;
I = A/G;
J = 6.24;
K = 5.68e-8;
N = 84.86;
O = 0.63;
P = 5.3e-8;
%%Equations
ode1 = A * (1/J)* diff((a * b),x,2) + B * diff(a,x,2) + C * O * J * K * diff(((1)/(b^2 + J * b + J * K)),x,2) == 0;
ode2 = E * diff(b,x,2) - B * diff(a,x,2) - 2 * C * O * J * K * diff(((1)/(b^2 + J * b + J * K)),x,2)- F * P* diff((1/b),x,2) ==0;
odes = [ode1; ode2];
%%Boundary conditions
bc1 = a(0) == (J * H * N)/3.47;
bc2 = E * diff(b,x) - B * diff(a,x) - 2 * C * O * J * K * diff(((1)/(b^2 + J * b + J * K)),x)- F * P* diff((1/b),x) ==0;
bc3 = a(I) == ((O * J * b)/(b.^2 + J * b + J * K));
bc4 = b(I)== 2.24e-4;
bc = [bc1; bc2; bc3; bc4];
[aSol, bSol] = dsolve(odes,bc)
fplot(aSol)
hold on
fplot(bSol)
legend('HSO_3^-','H^+','Location','best')
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers 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!