Shooting Method on ODE
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jan
2019-3-7
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
2019-3-7
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!