ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Trabajo Compound Pendulum


Enviado por   •  19 de Mayo de 2014  •  545 Palabras (3 Páginas)  •  312 Visitas

Página 1 de 3

Mass_Spring_Damper Tutorial ODE45 Function

ODE45 is used to solve linear or non-linear differential equations. This is done with a 4th and 5th order Runge-Kutta method to integrate the equations. NOTE - you DO NOT have to understand 4th and 5th order Runge-Kutta method to use ODE45 solver, check a numerical methods book if you are interested. You will only need to know the parameters to run the routine.

ODE45 has a typical form to use.

tspan = [t_start, t_final];

X0 = [x0, xdot0];

options = odeset('Refine',6,'RelTol',1e-4,'AbsTol',1e-7); [T, X] = ode45(@F, tspan, X0, options);

T in the left bracket is for time.

X is our main variables, in vector form.

F in the right side is a name of the subprogram for ODE45 solver which will be explained

in detail a little bit later).

tspan is the time period that you want to calculate, which consists of start time and end time. X0 contains the initial conditions for ODE variable, x0 = x(0), xdot0 = xdot(0).

options is the command that you can adjust the performance of ODE45 solver.

There are many options you can choose from, type 'help odeset' at the Matlab command line. 'Refine' controls the number of data points for ODE solver.

The higher the number after 'Refine' is more data points there are, but the slower the calculation is.

'RelTol' controls the relative error tolerance and 'AbsTol' controls the absolute error tolerances.

The following is an example of a pendulum problem which illustrates the use of ode45.

% Matlab example program #4

%The first few lines are for constant input values like mass of the bar, etc. The numbers given are

all arbitrary.

m=1;

g = 9.806; l=1;

tspan = [0,5];

% massofthebar

% acceleration of gravity % lengthofthebar

% time duration for calculation

Now, plug in the initial conditions for main variable, theta in this case, the rotation angle of bar.

theta = 1e-4; % initial displacement of the bar theta_dot = 0; % initial angular velocity of the bar

Note here there is a non-zero

...

Descargar como (para miembros actualizados)  txt (3.6 Kb)  
Leer 2 páginas más »
Disponible sólo en Clubensayos.com