2nd ode RK4
Show older comments
Hi All, I was requested to solve the following ode several weeks ago and suggested to use Runge-Kutta method. One of my friends suggested me to expand the equation (in symbloic) to solve. At the end of the day I could not do that by running through the elements by loop because some of the matries are samller. That will be very kind of you if you could help. Thank you very much again!!!
x"=P(x)*[C(x)*P(x)]^-1*[D(x,x')-C(x)*Q(x,x',Tr(y),F_g(x,x'))]+Q(x,x',Tr(y),F_g(x,x'))
F= [C(x)*P(x)]^-1*[D(x,x')-C(x)*Q(x,x',Tr(y),F_g(x,x'))]
x is 14x1 matrix
P is 14x8 matrix
F is 8x1 matrix
Q is 14x1 matrix
Tr is 6x1 matrix
y is 12x1 matrix
F_g is 4x1 matrix
C is 8x14 matrix
D is 8x1 matrix
The following matrix also made me worry in the solving process
where y=h_f(x) --> y=1 when x>0 else y=0
y=f_f(x) --> y=max(0,x)
where Tr is
Tr_1 = p_he*y(2)-p_hf*y(1);
Tr_2 = phe*y(4)-phf*y(3);
Tr_3 = pke*y(6)-pkf*y(5);
Tr_4 = pke*y(8)-pkf*y(7);
Tr_5 = (pae*y(10)-paf*y(9))*h_f(Fg_2);
Tr_6 = (pae*y(12)-paf*y(11))*h_f(Fg_4);
Where F_g
if y_r-y_g <0
Fg_1= -k_g*(x_r-x_r0) - b_g*(x_r_d);
Fg_2= -k_g*(y_r-y_r0) + b_g*f_f(-y_r_d);
else
Fg_1=0;
Fg_2=0;
end
if y_l-y_g <0
Fg_3= -k_g*(x_l-x_l0) - b_g*(x_l_d);
Fg_4= -k_g*(y_l-y_l0) + b_g*f_f(-y_l_d);
else
Fg_3=0;
Fg_4=0;
end
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!