Hello all, I am working on solving a 6 equation ODE to model the shape of a free surface in a channel. The paper that I am referencing only uses 5 euqations but i have no idea how they are solving for one of the variables so I added the variable and equation to the ODE. I have tried almost solver avalible in matlab and am very stuck on what to do next. Ive been in contact with the papers authors but they havent been a huge help. If anyone has a suggestion, it would be a huge help.
Here is the code:
beta0 = (1 + N)^2 / (1 + 2 * N);
ep0 = (h0 * hxx0) / (1 + hx0^2);
ep1 = hx0^2 / (1 + hx0^2);
S0 = (h0^2 / 2) + beta0 * (q^2 / (g * h0)) * (1 * ep0 * ((2 / (K + N + 2)) - ((1 - 2 * N) / (K + 2 * N + 2))) - ep1 * ((N + 1) / (N + 3)));
f0 = [h0; hx0; S0; theta; k;0];
options = odeset('RelTol',1e-5,'AbsTol',1e-7);
[x, f] = ode23tb(@undularODE, [x0 xfinal], f0, options);
Warning: Failure at t=3.074452e-03. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.092265e-17) at time t.
legend('h', 'hx', 'S', 'theta', 'k','N');
Here is the UdularODE function:
function dfdx = undularODE(x, f)
beta = (1 + N)^2 / (1 + 2 * N);
ep1 = f(2)^2 / (1 + f(2)^2);
Cf = 0.075 / (log(Re) - 2)^2;
sf = ff / 8 * (1 + 2 * (f(1) / 1)) * 1.47^2;
Ue = (1 + N) * (q / f(1));
H = (1.3 + 1.3 * (0.7 - k) + 3 * (0.7 - k)^2)^(2/3);
Rtheta = (Ue * theta) / Nu;
dUedx = -1*Ue*f(6)*(1+N2)*(Ue/f(1))*f(2);
gamma = (theta / Ue) * dUedx * Rtheta^(1/4);
dHdx = (3*k^2 - 5.5*k + 3.68)^(2/3) * ( (1.46*(1-k^2))/( (1.5+k)*theta*Rtheta^(1/4)* (gamma +0.118*(0.67-k)) ) );
eq2 = (((g * f(1)) / (beta * q^2)) * (f(3) - (f(1)^2 / 2)) - 1 + ep1 * ((N + 1) / (N + 3))) / ...
((f(1) / (1 + f(2)^2)) * (2 / (K + N + 2)) - ((1 - 2 * N) / (K + 2 * N + 2)));
eq4 = -1 * f(4)*((1 / (2 + 2 * N)) * (dHdx) - (1 / f(1)) * hx) * (H + 2) + Cf / 2;
eq5 = 1.46 * ((1 - f(5)^2) / ((1.5 + f(5)) * theta * Rtheta^(1/4))) * (gamma + 0.118 * (0.67 - f(5)));