I am trying use shooter's method to solve a second order differential equation

1 次查看(过去 30 天)
I am trying to loop and find the best value for curvature (im trying to find this) and will later put this in, but essentially I am trying to use shooters method to solve this: D^2y/dx^2 = F*sin(t)/(E*I)
i am using two first order diff eqs and solving via the boundary conditions.
this is as far as i got, my four equations are in the fun line:
d(theta)/dt = u
du/dt = Fsin(t)/EI
dx/dt = sin(t)
dy/dt = cos(t)
i am new to matlab, but i am interested in plotting the results of sin and cos. when i plot sin and cos so (shooterY and shooterX) is it not factoring in my equation at all? instead just plotting sin as a function of cos?
I just want to make sure I am doing this correctly with the ODE34 function
%variables
F = .024; %kg
E = 10^6; %mPa
I = 6.1*10^-9; %kg m^2
L = .01; %m
%for loop to cycle through and find best one
for curvature = 10^-7:10^-6:1*10^-6
fun = @(t, s) [s(2); F*sin(t)/(E*I); sin(t); cos(t)];%The actual function
tspan = [0 L]; %time to make sure goes to the lenght of the rod
Y0 = [0 curvature 0 0];%guesses that are beign cycled
[x,y] = ode45(fun, tspan, Y0);%fucntion to do the integrals
dt = y(1:end,1); du = y(1:end,2); shooterY = y(1:end,3); shooterX = y(1:end,4); %extracting the data
% if sin(t)/(EI) == 0
% break
% end
%break when moment at end is 0
end
  1 个评论
James Tursa
James Tursa 2022-7-14
Can you post an image of the actual differential equation and conditions you are solving so we can check that against your formulation?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by