% Second Order System Response Demonstration
% 
% SECONDORD  illustrates second-order measurement system responses, 
% including step response of a spring-mass-damper system (Example 3.8), 
% and sinusoidal forcing function response (Ex. 3.10).  The user can also 
% specify a custom forcing function.
% The display is set by one of five modes, selected by the popup menu 
% labeled "Input Function."
% 
% FORCE STEP MODE (normal startup mode)
% Force Step Mode illustrates the response of a spring-mass-damper system
% to a step change of the input force.  The editable parameters are:
% m   mass, default value 0.0028145 Kg
% Bf  damper friction, default value 0.021221 N-sec/m
% Ks  spring constant, default value 1 N/m
% Fi  initial force, default value 1 N
% Tf  final force, default value 2 N
% (the values of m and Bf were chosen arbitrarily to produce a system
% with natural frequency fn=3 Hz and damping zeta=0.2, given a static
% sensitivity of 1 m/N)
% The rise time and the settling time of the step response are indicated.
% 
% CONSTANT MODE
% Constant Mode shows the response of a generic second-order measurement 
% system to a constant forcing function.  This is the homogeneous
% response.  The difference between step mode and constant mode is, in
% constant mode both the initial conditions of the system are
% independently specified.  The editable parameters are:
% fn   natural frequency
% zeta damping ratio
% K    static sensitivity
% A    constant input
% y0   initial value
% yp0  initial rate of change
% 
% LINE SEGMENTS MODE
% In line segments mode, the forcing function is made up of the lines 
% connecting the points given in arrays t and F.  The default contents of
% t and F are:
% t=[0 0.499 0.5 0.999 1 1.499 1.5 1.999 2 2.499 2.5 3]';
% F=[1 1 -1 -1 1 1 -1 -1 1 1 -1 -1]';
% comprising a near-perfect square wave.  The interpolation scheme
% requires time to strictly increase.  The response of the generic second-
% order measurement system is calculated numerically.  The editable system 
% parameters are the same as in constant mode.
% Pushing the "Return" button returns the response to the main workspace
% variables tout and yout.  First you must select the output time basis.
% The natural output of ODE45 uses non-uniform time increments for optimum 
% accuracy and efficiency.  This is the time basis used in the display.
% You can accept this tout by pressing the "Display" button, or you can 
% specify a uniform sampling rate by pressing the "Resample" button.
% 
% START HARMONIC MODE
% Shows the startup transient for a generic second-order measurement
% system with a sinusoidal forcing function.  The parameters are:
% fn   natural frequency
% zeta damping ratio
% K    static sensitivity
% A    sine amplitude
% f    sine frequency
% y0   initial value
% yp0  initial rate of change
% The response is a transient, decaying from the initial values to the 
% sinusoidal asymptote (dotted line).
% 
% STEADY HARMONIC MODE
% Shows the steady response of the generic second-order measurement system
% to a sinusoidal forcing function.  Initial values are irrelevent to steady
% response.  The response magnitude B, the attenuation factor M (Eqn. 3.21),
% and the time delay (Beta sub 2) are indicated.  Pushing the "Freq. 
% Response" button starts a new window where the attenuation factor and 
% phase shift functions are displayed, with the frequency of the forcing 
% function marked.  If the system has resonant amplification, the resonant 
% frequency is also marked with a triangle.
% 
% SECONDORD(t,F) starts the window in Line Segments mode, and uses
% the given columns of time data t and forcing function data F(t), to 
% replace the default line segments.  t must be strictly increasing.
% 
% See also FOURCOEF, FUNSPECT, DATASPECT, SECONDORD, 
% MULTISYS, and SAMPLING.
 
