Hello everybody,
I am starting with Matlab to solve a system of 2 differential equations, second order.
My code is below. It works, but the output is totally wrong.
This code is something taken on matlab help center and adapted to my problem, to help me start.
I have written things in the code "#comment " where it's not clear to me.
Your help would be very helpful to me.
Thanks a lot in advance.
y0 = [x_to dx_t0 y_to dy_t0 ] ;
eq1 = diff(x,2) == -( (Cd*Af*rho_Air)/(2*m) ) * diff(x,1) * (x^2 + y^2)^(1/2)
eq2 = diff(y,2) == - g - ( (Cd*Af*rho_Air)/(2*m) ) * diff(y,1) * ( (diff(x,1))^2 + (diff(y,1))^2 )^(1/2)
V = odeToVectorField([eq1,eq2])
M = matlabFunction(V,'vars', {'t','Y'});
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),1000);
yValues = deval(ySol,tValues,1);