function bvp_shooting_rk_2()
rho_f = 783; rCp_f = 2090 * rho_f; k_f = 0.145; rb_f = 21e-6; Pr = 6;
rho_s1 = 1800; rCp_s1 = 717 * rho_s1; k_s1 = 5000; rb_s1 = 6.30e7;
rho_s2 = 10500; rCp_s2 = 235 * rho_s2; k_s2 = 429; rb_s2 = 63e-6;
m = 3; phi_s1 = 0.01; phi_s2 = 0.01; M = 0; K_p = 0.5; beta = 0.5;
B_i = 0.5; Q = 0.01; Ec = 0.8;
rho_hnf = (1-phi_s2)*((1-phi_s1)*rho_f + phi_s1*rho_s1) + phi_s2*rho_s2;
rCp_hnf = (1-phi_s2)*((1-phi_s1)*rCp_f + phi_s1*rCp_s1) + phi_s2*rCp_s2;
mu_hnf = mu_f / ((1-phi_s1)^2.5 * (1-phi_s2)^2.5);
k_bf = k_f * (k_s1 + (m-1)*k_f - (m-1)*phi_s1*(k_f - k_s1)) / (k_s1 + (m-1)*k_f - phi_s1*(k_f - k_s1));
k_hnf = k_bf * (k_s2 + (m-1)*k_bf - (m-1)*phi_s2*(k_bf - k_s2)) / (k_s2 + (m-1)*k_bf - phi_s2*(k_bf - k_s2));
rb_hnf = (1-phi_s2)*((1-phi_s1)*rb_f + phi_s1*rb_s1) + phi_s2*rb_s2;
sigma_bf = sigma_f * (1-phi_s1)^2.5;
sigma_hnf = sigma_bf * (1-phi_s2)^2.5;
A1 = (1-phi_s1)^2.5 * (1-phi_s2)^2.5 * ((1-phi_s2)*(1-phi_s1 + phi_s1*rho_s1/rho_f) + phi_s2*rho_s2/rho_f);
A2 = (1-phi_s2) * (1-phi_s1 + phi_s1*rho_s1/rho_f) + phi_s2*rho_s2/rho_f;
A3 = (1-phi_s2) * (1-phi_s1 + phi_s1*rCp_s1/rCp_f) + phi_s2*rCp_s2/rCp_f;
A4 = (1-phi_s1)^2.5 * (1-phi_s2)^2.5;
[xi, y, eta] = shooting_method(xi_guess, eta_end, tol, A1, A2, A3, A4, K_p, beta, Pr, k_f, k_hnf, Q, Ec, S);
plot(eta, y(:, 1), 'b-', 'LineWidth', 2);
title('Solution for f(\eta) using Shooting Method with RK');
plot(eta, y(:, 4), 'r-', 'LineWidth', 2);
title('Solution for \theta(\eta) using Shooting Method with RK');
function [xi, y, eta] = shooting_method(xi_guess, eta_end, tol, A1, A2, A3, A4, K_p, beta, Pr, k_f, k_hnf, Q, Ec, S)
options = odeset('RelTol', 1e-6, 'AbsTol', 1e-6);
y0 = [0; 1; xi_guess(1); S; xi_guess(2)];
[eta, y] = ode45(@(eta, y) ode_system(eta, y, A1, A2, A3, A4, K_p, beta, Pr, k_f, k_hnf, Q, Ec), [0 eta_end], y0, options);
bc_error_f_prime = y(end, 2);
bc_error_theta = y(end, 4);
while (abs(bc_error_f_prime) > tol || abs(bc_error_theta) > tol) && iteration_count < max_iterations
xi_new(1) = xi_new(1) - bc_error_f_prime * 0.1;
xi_new(2) = xi_new(2) - bc_error_theta * 0.1;
y0 = [0; 1; xi_new(1); S; xi_new(2)];
[eta, y] = ode45(@(eta, y) ode_system(eta, y, A1, A2, A3, A4, K_p, beta, Pr, k_f, k_hnf, Q, Ec, M), [0 eta_end], y0, options);
bc_error_f_prime = y(end, 2);
bc_error_theta = y(end, 4);
iteration_count = iteration_count + 1;
if iteration_count >= max_iterations
error('Shooting method failed to converge.');
function dydeta = ode_system(eta, y, A1, A2, A3, A4, K_p, beta, Pr, k_f, k_hnf, Q, Ec, M)
f_triple_prime = A1 * ((f_prime)^2 - f * f_double_prime) + A2 * M * f_prime + K_p * f_prime - beta * A1 * (f^2 * f_triple_prime - 2 * f * f_prime * f_double_prime);
theta_double_prime = k_f * Pr * (A3 * f * theta_prime - Ec * A4 * (f_double_prime)^2 - Q * theta) / k_hnf;
dydeta = [f_prime; f_double_prime; f_triple_prime; theta_prime; theta_double_prime];