Solving ODE45 equations in matlab without a function
Afficher commentaires plus anciens
I am struggling to figure out what is wrong with my code please help.
%%Numerically solving for Trajectory of the Ball in a Vacuum
clc
v0=25;
% Average football is punted at 25 m/s
theta=35;
% Chosen value for the angle of a punt
g = 9.8;
t=2.5;
t2 = 1.25;
CF = [.3 .385];
y0 = 0;
xdist = v0*cosd(35)*t;
yheight = (-.5*(g*(t2^2)))+v0*sind(theta)*t2;
% A ball punted with these variables would travel 51.2 meters horizontally
% and the max height would be 10.27 meters
x = zeros(1,2);
y0 = zeros(1,2);
t = [0 2.5];
[t,x] = ode45(@(t,x) (v0*cos(theta)*exp(-CF*t)), t, y0)
--------------------------------------
and I am receiving the errors:
Error using odearguments (line 90)
@(T,X)(V0*COS(THETA)*EXP(-CF*T)) must return a column vector.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!