13.07.2015 Views

An Integrated, Modular Simulation System for Education ... - Cal Poly

An Integrated, Modular Simulation System for Education ... - Cal Poly

An Integrated, Modular Simulation System for Education ... - Cal Poly

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

RK4 (Runge-Kutta) Help file%script RK4()%RK4.m% Given the transfer function 0.0165/(s^2+0.186s+0.0165) solving the differential% equation, this routine returns the values at the next time step% In this version we use the fourth-order Runge-Kutta method% to integrate.%% integrate to get current state% dt=time increment% Theta = pitch angle% deltaE = elevator angle% This function is free to copy and distribute <strong>for</strong> educational purposes as long% as this notice is included. No guarantee expressed or otherwise is made of the% accuracy of the code.% Eric Vinande/Doug Hiranaka 4-98% Copyright (c) 1998 by <strong>Cal</strong> <strong>Poly</strong> San Luis Obispohold on;%clear;DegToRad = 0.01745329;%***** begin inputs *****K = 1.0;wn = 0.12845;zeta = 0.5;deltaE = 1.0;dt = 0.5;tFinal = 100;%***** end of inputs *****%***** coefficients <strong>for</strong> Runge-Kutta method *****a = 2.0*zeta*wn;b = wn^2.0;c = wn^2.0;Theta(1)=0;z(1)=0;t = dt;Time(1)=0;index=2;while t

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!