Shooting Method on ODE

3 views (last 30 days)
Alexander Kimbley
Alexander Kimbley on 7 Mar 2019
Commented: darova on 7 Mar 2019
Hi, I'm pretty new to Matlab so bare with me please. I need use the ODE below in the ode45 command for the shooting method but I'm unsure how to write it in the correct form i.e. Y_1=... and Y_2=... if anyone could be so kind to re-write this for me I should be fine.
Thanks.
  2 Comments
Jan
Jan on 7 Mar 2019
The attached file MagneticShootingMethod.m contains this line only:
((x-c)^2 - B^2)*(y''-ay)=(2*B^2)*(y-(x-c)y')/((x-c)^2)
This is neither a clear description nor running Matlab code. I cannot guess, what "i.e. Y_1=... and Y_2=..." could mean.
Please post, what you have tried so far and explain the problem clearly.
darova
darova on 7 Mar 2019
function dy = odefcn(x,y,a,B,c)
dy = zeros(2,1);
dy(1) = y(2);
dy(2) = (2*B^2)*(y(1)-(x-c)*dy(1))./((x-c).^2);
dy(2) = dy(2) ./ ((x-c).^2 - B^2) + a*y(1);
end

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!