Hi I am trying to solve second order ode - wave equation - using ode45.
where B is magnetic field; x is depth inside the conductor freq, mu_0 and sigma_bulk are constants.
Below is the code
diff_func_smooth = @(x,B) [B(2);1i*2*pi*freq*mu_0*sigma_bulk*B(1)];
[t_smooth,B_smooth]=ode45(diff_func_smooth, d, initial_condition);
ylabel(ax1, 'Normalized B')
legend(ax1, 'Solved by ode45', 'Theoretical');
The final plot is
At the final depth values around 20um. The magnetic field overshoots despite the theoretical normalized magnetic field attending towards 0.
I was trying to use options, RelTol, AbsTol, MaxStep. Also, I have tried different solvers ode23, ode23s. The error at the end increases and decreases. But error remains. I am not sure which option to use, or what I am doing wrong. Please help Thanks!