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
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 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!