Skip to content
Permalink
96f03f6234
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
39 lines (21 sloc) 1 KB
% model parameters:
g = 9.81; % gravity in m s^{-2}
v_t = 5.5; % trim velocity in m s^{-1}
L_D = 5.2; % drag coefficient L/D
%%% set initial conditions %%%
v0 = v_t; % start at the trim velocity (or add a delta)
theta0 = pi/12; % initial angle of trajectory
x0 = 0; % horizotal position is arbitrary
y0 = 1000; % initial altitude
% Establish differential equations (theta, v are unknowns)
%dv_dt = -g*sin(theta) - 1/L_D * g/v_t^2 .* v^2;
%dtheta_dt = -g/v*cos(theta) + g/v_t^2 .* v;
% tip: use ode23 function, ode45 function (create "myODE" function -> get v and theta)
% Break these next equations up into tiny time steps starting at t=0 (numerical intergation)
%x = v*cos(theta);
%y = v*sin(theta);
% u = matrix of vectors [v, theta, x, y]
% use Euler method: solve at initial coditions + time step, set that as new initial conditions, repeat
tstep = 1; % set time step for Euler method
t = [0:tstep:100]; % time vector (seconds)
[TOUT,YOUT] = ode23(dv_dt,[0 100],y0);