PSS Common Module
MATLAB toolboxes for aerospace analysis
|
The Common module functions. View the published Common Demos. More...
Directories | |
directory | Atmosphere |
Atmosphere models. | |
directory | Classes |
Useful classes. | |
directory | ComponentModels |
CAD component models. | |
directory | Control |
Control functions. | |
directory | ControlGUI |
Control GUI. | |
directory | Database |
Database building functions. | |
directory | DemoFuns |
Functions supporting demos. | |
directory | Control |
Control scripts. | |
directory | ControlGUI |
Control loop test. | |
directory | Database |
Database demo. | |
directory | General |
General demes. | |
directory | GeneralEstimation |
Estimation demos. | |
directory | Graphics |
Graphics demos. | |
directory | Help |
FileHelp demo. | |
directory | Plugins |
Plugin demos. | |
directory | UKF |
Unscented Kalman filter demos. | |
directory | Estimation |
Estimation including extended and unscented Kalman filters. | |
directory | FileUtils |
File utilities. | |
directory | GUIs |
Dialogs and GUIs including time displays. | |
directory | General |
General purpose utilities. | |
directory | Graphics |
Graphics utilities. | |
directory | Interface |
Interfaces to other software. | |
directory | MassProperties |
Mass properties functions. | |
directory | Materials |
Materials properties utilities. | |
directory | Plugins |
Graphical PlugIn functions for building GUIs. | |
directory | Quaternion |
Quaternion utilities. | |
directory | Reliability |
Reliability of series and parallel items. | |
directory | Time |
Time utilities including Julian date. | |
directory | Transform |
Common coordinate transforms. | |
Functions | |
function | RFromCPAndGamma (in cP, in gamma) |
Computes R from cP and gamma. More... | |
function | SimpAtm (in altitude, in units) |
Simplified atmosphere model. More... | |
function | StdAtm (in altitude, in AtmData, in units) |
Computes atmospheric density based on the standard atmosphere model. More... | |
function | AggregateComponents (in c, in scale) |
Aggregate CAD component vertices and faces. More... | |
function | Box (in x, in y, in z, in openFace) |
Generate a box centered at the origin. More... | |
function | BoxWithRoundedSection (in x, in y, in z) |
Generate a box with a rounded section. More... | |
function | Cone (in p, in u, in halfAngle, in l, in n) |
Compute the vertices for a cone. More... | |
function | CylinderWithHemisphere (in r, in h) |
Generates a cylinder with a hemisphere on one end instead of a flat disk. More... | |
function | Disk (in r, in n, in z) |
Generate a disk. More... | |
function | Extrude (in z, in c, in topClosed, in bottomClosed, in cI) |
Generate an object from cross sections. More... | |
function | ExtrudeFromProfile (in z, in r, in topClosed, in bottomClosed, in n, in rI) |
Extrude from a radial profile. More... | |
function | Frustrum (in rL, in r0, in l, in n, in topOpen, in bottomOpen, in angleStart, in angleEnd) |
Generate a frustrum of a cone. More... | |
function | GeomPatch (in d, in cData, in cMap) |
Get vertices for surfaces of revolution, ellipsoids and cylinders. More... | |
function | Icosahedron () |
Generate an icosahedron inscribed in a unit sphere. More... | |
function | MeshEllipsoid (in a, in b, in c, in n) |
Create a mesh ellipsoid. More... | |
function | OpenFrame (in x, in y, in h, in t) |
Generate an open frame. More... | |
function | ParabolicReflector (in d, in f, in m, in p) |
Generate a parabolic reflector. More... | |
function | PartialDisk (in r, in t, in n, in angle) |
Generate vertices and faces for a full or partial disk. More... | |
function | PlateTwoSided (in x, in y, in z) |
Generate a plate in the xy plane. More... | |
function | Ring (in rO, in rI, in l, in w, in n) |
Generate a ring with specified inner and outer wall, and length. More... | |
function | SectorPatch (in r0, in u1, in u2, in scale) |
Compute faces and vertices for a sector patch. More... | |
function | ShapedStrut (in x1, in x2, in c) |
Generate strut going from x1 to x2. More... | |
function | Strut (in x1, in x2, in r1, in r2, in n) |
Generate a variable radius strut going from x1 to x2. More... | |
function | Torus (in c, in r, in n, in c2, in nuX) |
Draws a torus. More... | |
function | Triangle (in x, in y, in z, in mass) |
Generate a solid triangle. More... | |
function | TriangularTruss (in x1, in x2, in d, in n) |
Generate a triangular truss going from x1 to x2. More... | |
function | Truss (in x1, in x2, in w, in n, in wBar) |
Generate a square truss going from x1 to x2. More... | |
function | Tube (in rO, in rI, in l, in n) |
Generate a tube with specified inner and outer wall, and length. More... | |
function | TubeArc (in rO, in rI, in l, in arc, in n) |
Generate a portion of a tube with an inner and outer wall. More... | |
function | TubeSection (in rO, in rI, in l, in ang1, in ang2, in n) |
Generate a tube with specified inner and outer wall, and length. More... | |
function | TubeWithBends (in r, in p, in nB, in nC) |
Generate a tube with bends. More... | |
function | Tubing (in p, in d, in n) |
Generate a tube through the points p. More... | |
function | UChannel (in x, in y, in z, in t, in d, in b) |
Generate a box with a u cut at the +x end. More... | |
function | Wedge (in x1, in x2, in w, in t) |
Generate a wedge between x1 and x2. More... | |
function | Acker (in a, in b, in p) |
Gains for poles using Ackermann's formula. More... | |
function | ACTF (in e) |
Generic sensor or actuator model. More... | |
function | Alias (in w, in ws) |
Computes the fundamental alias of a frequency. More... | |
function | AllanVariance (in x, in t) |
Implements the overlapping Allan Variance. More... | |
function | Append (in a1, in b1, in c1, in d1, in a2, in b2, in c2, in d2) |
Appends two state space systems. More... | |
function | BalReal (in a, in b, in c, in d) |
Compute the balanced realization of a, b, c, d. More... | |
function | BalRealG (in g) |
Computes a balanced realization of g. More... | |
function | BodeGP (in g, in w) |
Computes the phase using the Bode gain phase rule. More... | |
function | C2DelZOH (in a, in b, in T) |
Create a discrete time systems using the delta operator. More... | |
function | C2DFOH (in a, in b, in T) |
Create a discrete time system using a first order hold. More... | |
function | C2DPulse (in a, in b, in T, in tau) |
Create a discrete time system assuming a pulse at the input. More... | |
function | C2DZOH (in a, in b, in T) |
Create a discrete time system using a zero order hold. More... | |
function | C2DZOHWD (in a, in b, in c, in T, in Td) |
Create a discrete time system using a zero order hold and delay. More... | |
function | CButter (in n, in wC, in tSamp, in sType) |
Create a continuous Butterworth Filter. More... | |
function | CCVModel (in q) |
Generate CCV (control configured vehicle) aircraft model. More... | |
function | CGram (in a, in b) |
Compute the controllability gramian for a continuous time system. More... | |
function | CInputs (in t, in tStart, in d, in type) |
Generates different control inputs. More... | |
function | CLoopS (in a, in b, in c, in ac, in bc, in cc, in dc) |
Creates a closed loop system. More... | |
function | CLPoles (in a, in b, in c, in f, in g, in h, in k) |
Computes the closed loop poles. More... | |
function | CompE (in x, in sType, in dT) |
Create a SISO compensator using a variety of compensator elements. More... | |
function | CToD (in g, in dT, in sType) |
Create a discrete time compensator from a continuous time compensator. More... | |
function | DBalReal (in a, in b, in c, in d) |
Compute a balanced realization for discrete time systems. More... | |
function | DBode (in a, in b, in c, in d, in iy, in iu, in w, in dT) |
Generates a Bode plot for a discrete time system. More... | |
function | DCGain (in a, in b, in c, in d, in sType) |
Computes the DC gain of a discrete time state space system. More... | |
function | DCGram (in a, in b) |
Compute the controllability gramian for a discrete time system. More... | |
function | Delay (in T, in n) |
Create a model of a delay using Pade approximants for exp(-sT). More... | |
function | DigitalFilter (in uNew, in nN, in dN, in xN, in uN) |
Implement a digital filter. More... | |
function | DispG (in action, in modifier) |
Display a statespace system using vertical bar charts. More... | |
function | DOGram (in a, in c) |
Compute the observability gramian for a discrete time system. More... | |
function | DQCE (in phi, in gamma, in h, in rw, in rv) |
Create an optimal estimator. More... | |
function | DQCR (in a, in b, in q, in r, in n) |
Create a quadratic regulator. More... | |
function | DRiccati (in g) |
Solves the discrete matrix Riccati equation. More... | |
function | EigEval (in g, in hAxes) |
Evaluate the eigenvalues and eigenvectors graphically. More... | |
function | ESAssign (in g, in lambda, in vD, in fC) |
Apply eigenvector and eigenvalue assignment. More... | |
function | ESAssignDraper (in g, in lambda, in vD, in r, in fC) |
Apply eigenvector assignment using the Draper method. More... | |
function | EVAssgnC (in g, in lambda, in vD, in d, in rD, in w) |
Use eigenvector assignment to design a controller. More... | |
function | EVAssgnE (in g, in lambda, in vD, in d, in rD) |
Use eigevector assignment to design an estimator. More... | |
function | EVDesMat (in nStates, in kAssign) |
Create the design matrix for the eigenstructure assignment technique. More... | |
function | FFTEngy (in y, in tSamp, in aPeak, in noLog) |
Plot the energy in a signal. More... | |
function | FindPeaks (in x, in y) |
Find peaks of the inputs by looking at slopes. More... | |
function | FOPID (in e, in d) |
Fractional order PID controller. More... | |
function | FResp (in a, in b, in c, in d, in iu, in iy, in w, in uPhase, in pType) |
Compute the frequency response of the system given a, b, c and d. More... | |
function | FRespG (in f, in iu, in iy, in w, in uPhase, in pType) |
Compute the frequency response given the statespace class as input. More... | |
function | FRespPlot (in mag, in phase, in w, in pType, in iu, in iy) |
Plot the frequency response of the system in Bode or Nichols form. More... | |
function | Gen2nd (in zz, in wz, in zp, in wp, in tSamp, in sType) |
Creates a second order transfer function. More... | |
function | GND (in num, in den, in w) |
Compute the frequency response given a numerator/denominator pair. More... | |
function | GPMargin (in m, in p, in w) |
Computes gain and phase margins from magnitude and phase. More... | |
function | GSS (in a, in b, in c, in d, in iu, in iy, in w) |
Compute the multivariable frequency response of the system. More... | |
function | IC (in g, in x, in dT, in nSim) |
Generate a response to an initial condition vector. More... | |
function | Integral (in Kdc, in w, in phase, in tSamp, in sType) |
Creates a general integrator. More... | |
function | InvSys (in a, in b, in c, in d) |
Computes the inverse system. More... | |
function | JLQOF (in k, in g, in w, in x) |
Linear quadratic regulator with an output feedback cost function. More... | |
function | JLQTOF (in k, in g, in w, in t) |
Output feedback design with a reference input. More... | |
function | JLQTWOF (in k, in g, in w, in t, in options) |
Output feedback design with a reference input. More... | |
function | KronProd (in a, in b) |
Compute the Kronecker product. More... | |
function | KronSum (in a, in b) |
Compute the Kronecker sum. More... | |
function | KSmooth (in r, in phi, in q, in h, in z, in pI) |
Mechanizes a Kalman Filter fixed interval smoother. More... | |
function | LeadLag (in wmax, in phasemax, in Kdc, in tSamp, in sType) |
Create a lead or lag. More... | |
function | LFBal (in g, in gamma) |
Perform low frequency prebalancing of a system. More... | |
function | Limit (in x, in limit) |
Limits a matrix. More... | |
function | LQC (in g, in w, in type, in t) |
Design a quadratic controller. More... | |
function | MagPlot (in a, in b, in c, in d, in iu, in iy, in w) |
Compute the magnitude frequency response of a system.s. More... | |
function | MSR (in g, in q) |
Mean squared response of a system. More... | |
function | ND2SS (in num, in den) |
Creates state-space model from numerator and denominator polynomials. More... | |
function | NLFilter (in f, in h, in x, in t, in k, in u, in y, in dT) |
Implements a nonlinear fixed gain filter. More... | |
function | Notch (in Kdb, in wc, in dw, in fType, in tSamp, in sType) |
Creates a second order transfer function. More... | |
function | NQuant (in lSB, in rType) |
Computes the variance for various types of roundoff. More... | |
function | NumericalTransferFunction (in f, in dT) |
Computes a numerical transfer function from the impulse response. More... | |
function | Nyquist (in varargin) |
Generate a Nyquist plot from a statespace object or gain/phase data. More... | |
function | OGram (in a, in c) |
Compute the observability gramian for a continuous time system. More... | |
function | P3Axis (in qECIToBody, in d) |
A 3-axis proportional controller. More... | |
function | Parallel (in a1, in b1, in c1, in d1, in a2, in b2, in c2, in d2) |
Parallel connects two state space models. More... | |
function | PDDesign (in zeta, in wN, in wD, in inr, in tSamp, in sType) |
Design a PD controller. More... | |
function | PGains (in g, in k, in w) |
Compute the principal gains for a system. More... | |
function | PhasePlane (in v, in x, in k, in db, in rl) |
Implements a phase plane controller. More... | |
function | PID (in kF, in kP, in kR, in kI, in omegaR, in tSamp, in sType) |
Design a PID controller. More... | |
function | PIDesign (in zeta, in wN, in inr, in tSamp, in sType) |
Design a PI controller. More... | |
function | PIDMIMO (in inr, in zeta, in omega, in tauInt, in omegaR, in tSamp, in sType) |
Produces a state space n degree of freedom PID controller. More... | |
function | PIDProper (in KP, in KI, in KD, in wR, in w) |
Compute proper and non-proper transfer functions for a PID. More... | |
function | PIDWithLag (in d) |
Creates a PID controller with lag compensation. More... | |
function | PILeaky (in k0, in kInf, in w0Db, in tSamp, in sType) |
Design a leaky PI controller. More... | |
function | PrintEigenvalues (in g, in f, in t) |
Print eigenvalues to the command window. More... | |
function | PropStateSpace (in g, in x, in u) |
Propagate a state space model. More... | |
function | PWM (in tau, in tSamp, in n) |
Create a model of a pulsewidth modulator using Padé approximants. More... | |
function | QCE (in a, in c, in q, in r, in b, in n) |
Create an estimator from a state space system. More... | |
function | QCR (in a, in b, in q, in r, in n) |
Creates a linear quadratic regulator from a state space system. More... | |
function | Quant (in x, in lsb, in rType) |
Quantizes a matrix using user defined rounding. More... | |
function | Riccati (in g) |
Solves the matrix Riccati equation. More... | |
function | RootLocus (in g, in k) |
Generate the root locus for s SISO system. More... | |
function | RootSort (in r) |
Sort columns of roots for Root Locus. More... | |
function | RouthArray (in p) |
Computes the Routhian array for a polynomial. More... | |
function | S2Damp (in s) |
Eigenvalues to damping and natural frequency. More... | |
function | S2Z (in a, in b, in c, in d, in dT, in sType) |
Transform an s-plane transfer function into the z-plane. More... | |
function | SelectS (in a, in b, in c, in d, in kS, in kO, in kI) |
Extract selected states from a state space model. More... | |
function | Series (in a1, in b1, in c1, in d1, in a2, in b2, in c2, in d2) |
Series connects two state space models. More... | |
function | ShapeFlt (in wN, in width, in depth, in wL, in tSamp, in sType) |
Generates a shaping filter with notches and first order roll off. More... | |
function | SizeAB (in a, in b) |
Checks the dimensions of the set a, b for consistency. More... | |
function | SizeABCD (in a, in b, in c, in d) |
Checks the dimensions of the set a,b,c,d for consistency. More... | |
function | SizeAC (in a, in c) |
Checks the dimensions of the set a, c for consistency. More... | |
function | SRiccati (in g) |
Solves the matrix Riccati equation. More... | |
function | SS2ND (in a, in b, in c, in d, in iu) |
Converts from state space to numerator denominator form. More... | |
function | SSEmpty () |
Creates an empty state space system. More... | |
function | SSFromNonlinear (in f, in x, in t, in u, in kUse, in varargin) |
Computes state space matrices from a nonlinear function. More... | |
function | StatePrp (in a, in b, in c, in d, in x, in u, in sType) |
Propagates state equations. More... | |
function | SteadyS (in a, in b, in c, in d, in y, in q, in r) |
Determine the steady state control for a state space system. More... | |
function | Step (in g, in iU, in dT, in nSim, in inputType, in statesFlag) |
Generate a step response of a state space system. More... | |
function | SVPlot (in g, in w) |
Computes the maximum and minimum singular values. More... | |
function | TResp (in g, in x0, in u, in dT, in T) |
Compute the time response of a state-space system. More... | |
function | TrnsZero (in a, in b, in c, in d) |
Computes the transmission zeros of a plant. More... | |
function | TTPlots (in mag, in w, in t, in gU, in title) |
Generates torque transmission plots. More... | |
function | Windup (in a, in b, in c, in d, in p, in sType) |
Implements anti windup compensation. More... | |
function | WPZ (in a, in b, in c, in d, in n, in iu, in iy) |
Frequency vector with complex poles and zeros. More... | |
function | WReson (in lmin, in lmax, in n, in w) |
Creates a frequency vector with points around resonances. More... | |
function | Z2Damp (in z, in T) |
Z domain to s domain damping and natural frequency. More... | |
function | Z2S (in f, in g, in h, in j, in dT, in sType) |
Transform an z-plane transfer function into the s-plane. More... | |
function | ZFresp (in num, in den, in n) |
Generates the frequency response for a digital filter. More... | |
function | ZOH (in T, in n) |
Create a model of a zero-order-hold using Padé approximants. More... | |
function | AddOuterLoop (in gInner, in gOuter, in e) |
Add an outer loop for a controller. More... | |
function | AssembleBlock (in x) |
Assemble a block given the data structure. More... | |
function | AssemblePlant (in gIn, in e, in in, in openLoop) |
Assemble a plant given a model described by gIn. More... | |
function | BlockDiagramPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create a BlockDiagram GUI plug in. More... | |
function | ControlDesignGUI (in action, in modifier, in u) |
Design control systems using a GUI. More... | |
function | DualListPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create dual lists. More... | |
function | EigenstructurePlugIn (in action, in modifier, in hFig, in position, in callback) |
Create an Eigenstructure GUI plug in. More... | |
function | EmptyBlock () |
Produce an empty data structure used by the control functions. More... | |
function | EmptySISO () |
Produce an empty data structure used by the control functions. More... | |
function | LQPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create an LQ plug in for the ControlDesignGUI. More... | |
function | MapIOPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create an MapIO plug in for the ControlDesignGUI. More... | |
function | ModalReductionPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create a ModalReduction plug in for the ControlDesignGUI. More... | |
function | ModalTransform (in g) |
Transform the system a,b,c,d into modal form. More... | |
function | ModelPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create an Model GUI plug in. More... | |
function | ReduceModal (in g, in k) |
Retain modes k of the system a,b,c,d. More... | |
function | ReduceOrder (in g, in k) |
Retain states k of the system a,b,c,d. More... | |
function | ReduceOrderPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create a model order reduction GUI plug in. More... | |
function | SISOListPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create a list of SISO elements for use by control design tools. More... | |
function | SISOPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create an SISO GUI plug in. More... | |
function | BuildConstant (in name) |
Build the constant database. More... | |
function | Constant (in q, in gUICode) |
Outputs the value of a constant or opens a GUI for searching. More... | |
function | Database (in q, in gUICode) |
GUI to output the value of a constant. More... | |
function | MergeConstantDB (in action, in a, in b) |
Merges b into a using a GUI. More... | |
function | DoubleIntegratorRHS (in x, in ignoredArg, in u, in mass) |
Right hand side for a double integrator. More... | |
function | FNLSpring (in x, in ignoredArg, in fData) |
Nonlinear estimator spring model. More... | |
function | HNLSpring (in x, in ignoredArg, in hData, in ignoredArg) |
Nonlinear estimator measurement spring model. More... | |
function | MeasSpring (in x, in ignoredArg) |
Spring measurement. More... | |
function | OscillatorRHS (in x, in ignoredArg, in u, in mass, in omega) |
Right hand side for a spring. More... | |
function | RHSDoubleIntegrator (in x, in ignoredArg, in u, in mass) |
Right hand side for a double integrator. More... | |
function | RHSNLSpring (in x, in ignoredArg, in d) |
Nonlinear estimator spring model. More... | |
function | RHSOscillator (in x, in ignoredArg, in u, in mass, in omega) |
Right hand side for a spring. More... | |
function | RHSSpring (in x, in ignoredArg, in d) |
Computes the right hand side for a linear spring. More... | |
function | RHSX (in x, in ignoredArg, in d) |
Right hand side for a one dimensional vertical motion simulation. More... | |
function | AngleSensor (in x, in d) |
Angle sensor. More... | |
function | CDKF (in d, in fName, in hName) |
Continuous discrete iterated extended Kalman Filter. More... | |
function | CWPAModel (in dT) |
Continuous Wiener process acceleration (CWPA) model. More... | |
function | EKFPredict (in d) |
Extended Kalman Filter prediction step. More... | |
function | EKFUpdate (in d) |
Extended Kalman Filter measurement update step. More... | |
function | FXNLSpring (in x, in ignoredArg, in d) |
Jacobian of RHSUKF. More... | |
function | IEKFUpdate (in d) |
Iterated Extended Kalman Filter measurement update step. More... | |
function | IMMPredict (in d) |
Interactive Multiple Models prediction step. More... | |
function | IMMUpdate (in d) |
Interactive Multiple Models update step. More... | |
function | KalmanFilterCombine (in xB, in pB, in xF, in pF) |
Combine forward and backward covariances and states. More... | |
function | KFilter (in r, in phi, in q, in h, in x, in z, in p, in gamma, in u, in s) |
Mechanizes one step of a Kalman Filter with a forgetting factor. More... | |
function | KFInitialize (in type, in varargin) |
Initializes Kalman Filter data structures for the KF, UKF, EKF and IEKF. More... | |
function | KFPredict (in varargin) |
Linear Kalman Filter prediction step. More... | |
function | KFUpdate (in varargin) |
Linear Kalman Filter measurement update step. More... | |
function | MeasNLSpring (in x, in d) |
Computes nonlinear spring measurement. More... | |
function | MeasPartialNLSpring (in x, in d) |
Computes nonlinear spring measurement partial derivative. More... | |
function | RHSPartialNLSpring (in ignoredArg, in ignoredArg, in d) |
Nonlinear estimator spring model. More... | |
function | RTSS (in mP, in pP, in m, in p, in a) |
Rauch-Tung-Striebel smoothing. More... | |
function | SigmaPointsChol (in d, in p, in varargin) |
UKF sigma points using chol. More... | |
function | Symmetrize (in p) |
Makes a square matrix symmetric by adding its transpose and dividing. More... | |
function | UDKalmanFilter (in action, in d, in z) |
Implements a Kalman filter using UD factorization. More... | |
function | UKF (in action, in d, in y, in verbose) |
Implement an Unscented Kalman Filter. More... | |
function | UKFP (in action, in d, in y) |
Implement an Unscented Kalman Filter for parameter estimation. More... | |
function | UKFPredict (in d) |
Unscented Kalman Filter state prediction step. More... | |
function | UKFRTSS (in m, in p, in d) |
Rauch-Tung-Striebel smoothing for an Unscented Kalman Filter. More... | |
function | UKFUpdate (in d) |
Unscented Kalman Filter measurement update step. More... | |
function | UKFUT (in m, in p, in c, in wM, in w, in fun, in dFun) |
Unscented Kalman Filter transform. More... | |
function | UKFWeight (in d) |
Unscented Kalman Filter weights. More... | |
function | UKUDF (in action, in d, in y) |
Implement an Unscented Kalman Filter in UD (upper diagonal) form. More... | |
function | DateChanged (in date, in directory) |
Find a list of files in the directory who have been modified after. More... | |
function | FileFullpath (in filename, in overwrite) |
Save the file at the path of the calling function. More... | |
function | FindDirectory (in d, in ignoredArg) |
Returns the path to a directory. More... | |
function | FindInFiles (in string, in caseSensitive, in wholeWord, in includeComments, in fileSet) |
Find all files that contain a specified string. More... | |
function | FindRequiredFiles (in FunctionIn, in DirectoryIn, in verbose) |
Find the files required by a function or a script in order to run. More... | |
function | FindStringInFiles (in z, in d) |
Finds all instances of the string z in directory d. More... | |
function | FirstLineOfCode (in filename) |
Return the first line of code for a m-file. More... | |
function | FixLineEndings (in s) |
Make line endings consistent with the platform. More... | |
function | GetFileRoot (in s) |
Get the root name of a file (without the .xxx) More... | |
function | GetFileSuffix (in s) |
Get the suffix of a file, i.e. More... | |
function | GetHeaders (in p) |
Finds all files in the directory d. More... | |
function | GetModificationDate (in fileName, in p) |
Gets the modification date. More... | |
function | IsFunction (in filename) |
Determine whether a file is a function or script. More... | |
function | OpenFile (in path, in file, in suffix, in heading, in permission) |
Open a file using a GUI if it is not specified. More... | |
function | PathDirectories () |
Generate a cell array list of all directories in the Matlab path. More... | |
function | RemoveContentsFile (in x) |
Removes the 'Contents.m' file from a cell array of file names. More... | |
function | AddToList (in h, in s, in n) |
Add an item to a uicontrol listbox. More... | |
function | AddToPath (in dirName) |
Add a local directory to the path and return to the current directory. More... | |
function | AllCaps (in s) |
Determines if the string is all capital letters. More... | |
function | ArrayToLinspace (in x) |
Converts an array a s function string. More... | |
function | AssignFHandle (in fName) |
Assign either a string or function handle depending on the MATLAB version. More... | |
function | Cell2DToStruct (in y, in m) |
Convert a structure into a cell array where columns of the array. More... | |
function | CellToMat (in c) |
Converts a cell array to a matrix. More... | |
function | CenterFigure (in width, in height) |
Find a position array that centers a figure. More... | |
function | ChangePath (in newPath) |
Change the path. More... | |
function | CloseFigure (in h) |
Close a figure. More... | |
function | CloseIfHandle (in h) |
Close h if it is a handle to a figure. More... | |
function | CloseMatFile (in kOpenPre) |
Closes every file not listed in kOpenPre. More... | |
function | CloseUIElement (in h) |
Close a UIElement. More... | |
function | ColumnSizeCellArray (in m, in f) |
Outputs the size of each column of a cell array. More... | |
function | ConvertFortranFormatToC (in f) |
Convert Fortran formats to C. More... | |
function | CPIAdjust (in cC, in yearC, in yearN) |
Consumer Price Index adjustment. More... | |
function | CreateHTMLTable (in x, in fileName, in fString, in title) |
Creates an HTML table from x. More... | |
function | CreateLatexTable (in x, in fileName, in fString, in title) |
Creates a LaTeX table from x. More... | |
function | CreateTable (in x, in fileName, in fString, in sep) |
Creates a table from x for displaying to the command line. More... | |
function | DeBlankAll (in s) |
Delete all blanks. More... | |
function | DeBlankLT (in s) |
Delete leading and trailing blanks. More... | |
function | DebugLog (in msg, in fullPath) |
Display a message to help debugging. More... | |
function | DeleteCell (in c, in k) |
Delete a cell element of a one dimensional cell array. More... | |
function | DeleteFromList (in h) |
Delete the selected item from a list. More... | |
function | DeleteIfHandle (in h) |
Close h if it is a handle. More... | |
function | DeleteSuffix (in x) |
Deletes the .xxx part of a name. More... | |
function | DirToCell (in path, in y) |
Converts a directory list into a cell array. More... | |
function | DisplayLatexTable (in s) |
Displays a LaTeX table. More... | |
function | DispWithTitle (in x, in t) |
Display a variable with a title. More... | |
function | EditScroll (in action, in modifier, in hFig, in position) |
Implement a scrollable edit window. More... | |
function | Equal (in a, in b) |
Returns one if a and b are identical. More... | |
function | fixpopupuicontrol (in fig) |
This function found on Mathworks website as a bug-fix for MATLAB 7. More... | |
function | flength (in f) |
Give the length of a file in bytes. More... | |
function | Fractal (in v, in f, in n, in sigma) |
Generates fractals. More... | |
function | FSWClock (in action, in d) |
This routine implements the flight software clock. More... | |
function | FunNames (in path) |
Get Function Names. More... | |
function | GetCurrentGUIObject (in hFig) |
Gets the last uicontrol that was hit. More... | |
function | GetEntry (in h, in d, in errMsg) |
Gets the input from a vector of graphics handles and determines. More... | |
function | GetInputFromString (in s) |
Generates an output from a string. More... | |
function | GetListString (in h) |
Get an element from a list uicontrol. More... | |
function | GetNewTag (in name) |
Get a new tag to uniquely identify a figure. More... | |
function | GetUIElement (in h, in property) |
Get certain properties of UIElements. More... | |
function | HasOptimizationToolbox () |
Returns 1 if a licensed optimization toolbox is in your path. More... | |
function | Inflation (in from, in to) |
Computes U.S. More... | |
function | IntToBinary (in i) |
Converts an integer to binary [lsb msb] in two's complement. More... | |
function | IsValidField (in m, in s) |
Determine if a field exists and is not empty. More... | |
function | IsVersionAfter (in n) |
Checks to see if the version of MATLAB is after n. More... | |
function | IsVersionBefore (in n) |
Checks to see if the version of Matlab is before n. More... | |
function | LatexExp (in n, in f) |
Creates a latex exponential string. More... | |
function | LatexScientificNotation (in x, in n, in m) |
Converts a number into a string using latex notation. More... | |
function | LatexTableFromStructure (in s, in f, in u) |
Creates a LaTeX table from s. More... | |
function | ListCases (in filename, in beQuiet, in first) |
List the switch cases that are included in a given file. More... | |
function | ListFunctions (in filename, in level, in noMatlabFuns, in method) |
List the functions that are called from a given file. More... | |
function | ListMemberFunctions (in filename, in verbose) |
List the member functions that are included in a given function/file. More... | |
function | ListParents (in fcn, in folder, in recursive) |
List all parents of a function. More... | |
function | LogB (in b, in x) |
Log base b. More... | |
function | MatrixCellTo3D (in c) |
Convert a cell array of p x p matrices into a 3D matrix. More... | |
function | MatrixDisplay (in x, in f) |
Display a matrix using the format f. More... | |
function | MatToCell (in m) |
Converts a string matrix to a cell array. More... | |
function | Num2Str1Line (in n, in d) |
Converts a matrix to a one line string. More... | |
function | PrintTitle (in t) |
Print a title with — under and above. More... | |
function | ProcessTag (in action, in tag, in k, in name) |
Code used to process tags for sensors and actuators. More... | |
function | RadioButtons (in action, in modifier, in hFig, in position, in rows, in format, in cB) |
Create radio buttons. More... | |
function | RequiredFields (in g, in r) |
Returns 1 if the data structure g has the required fields in r. More... | |
function | SaveMovie (in m, in fileName) |
Save a MATLAB movie. More... | |
function | SaveStructure (in gXXXX, in fileName) |
Save a structure in a file. More... | |
function | SetUIElement (in h, in varargin) |
Set certain properties of UIElements. More... | |
function | SortColumnCell (in x) |
Sort a nxm cell array by the values in the first column. More... | |
function | Staircase (in t, in dT, in varargin) |
Generates steps for any number of inputs. More... | |
function | StringMatch (in s, in sA, in ignoredArg) |
Finds which elements of sA match s. More... | |
function | StringToToken (in s) |
Finds the first token in a string. More... | |
function | StringToTokens (in s, in delimiters, in noSpace) |
Converts a string to a list of tokens. More... | |
function | StrMtch (in s, in sM) |
In a matrix with each row a string finds the first matching string. More... | |
function | StructToCell2D (in x) |
Convert a structure into a cell array. More... | |
function | StructToText (in data, in textFileName) |
Write data structure to a text file or command line display. More... | |
function | StructureList (in action, in modifier, in d, in name, in position, in hFig) |
Creates a list of structures and variables. More... | |
function | UIElement (in varargin) |
Interface to PSS and Mathworks UI. More... | |
function | ValidTime (in t) |
Returns the time if valid. More... | |
function | WaitBarManager (in action, in d) |
Manages the wait bar. More... | |
function | Watermark (in string, in fig, in pos, in color) |
Add a watermark to a figure. More... | |
function | AddAxes (in m, in r, in T, in h, in c, in label) |
Adds x,y,z coordinate axes to a figure. More... | |
function | AddDeltaModeToPlot (in hAxis, in oldMode, in newMode, in t, in x) |
Add mode changes to a plot. More... | |
function | AddFillToPlots (in time, in data, in h, in colors, in alpha) |
Find mode changes in data and draw as filled sections on existing plots. More... | |
function | AddView (in h) |
Add view accelerators to a figure. More... | |
function | AddZoom (in h) |
Add zoom-in (CTRL+I) and zoom-out (CTRL+O) accelerators to a figure. More... | |
function | AnglePatch (in v1, in v2, in z, in c, in f) |
Draw a patch showing the inner angle between two vectors. More... | |
function | AnimateCube (in action, in modifier, in x) |
Draw a cube given its dimensions. More... | |
function | AnimateVectors (in varargin) |
Animate one or more time-varying vectors. More... | |
function | Animator (in fig, in data, in background, in style, in markersize, in linewidth) |
Animate a set of 2xN or 3xN matrices over N steps. More... | |
function | Arrow3D (in r, in l, in g, in u, in c, in alpha, in hA) |
Draws a 3D arrow into an existing figure. More... | |
function | AssignColors (in n, in sat, in val) |
Choose n colors from around the RGB color wheel. More... | |
function | AttitudeCoordinates (in varargin) |
Draw attitude coordinates. More... | |
function | AxesCart (in xMin, in yMin, in zMin) |
Draw axes on the current plot with X, Y, Z, text labels. More... | |
function | Axis3D (in s) |
Adjust 3D axes properties. More... | |
function | AxisEqual (in axisHandle, in minSize, in dim) |
Equalize the axes with a minimum relative size for the smallest axis. More... | |
function | BarPlot (in x, in y) |
Creates a bar plot of x. More... | |
function | CameraControls (in varargin) |
This function creates a GUI for manipulating the camera view. More... | |
function | Centroid (in v) |
Compute a centroid from a set of vertices. More... | |
function | Circle (in r, in xc, in yc, in n) |
Compute x y data for a 2-D Circle. More... | |
function | ColorMapGrayScale () |
Generates a gray scale colormap with 256 entries. More... | |
function | ColorSpread (in n, in map) |
Produce a set of 3-element RGB colors that spread across the colormap. More... | |
function | ConvertOBJFileColorToMatlab (in m) |
Converts the Wavefront OBJ color format to MATLAB. More... | |
function | Coordinates (in m) |
Creates a figure with x,y,z coordinates at the origin. More... | |
function | DiskWithHole (in rI, in rO, in n, in z) |
Draw a disk. More... | |
function | DistanceLabel (in d) |
Rescales distances. More... | |
function | DrawCAD (in g, in drawNormals, in scale) |
Draw a CAD model stored in the toolbox CAD format. More... | |
function | DrawFOV (in f, in l, in axesHandle) |
Draw fields of view. More... | |
function | DrawImage (in hParent, in position, in file, in path, in width) |
Draws an image in a figure window. More... | |
function | DrawSphere (in R, in surfCol, in lineCol, in latMarks, in longMarks) |
Draw a sphere with specified latitude and longitude lines. More... | |
function | DrawTreeDiagram (in hFig, in tree, in position, in buttonDownFunction) |
Creates and draws a tree diagram. More... | |
function | DrawVertices (in v, in f, in name, in blend) |
Draw and object from vertices in a figure window using patch. More... | |
function | Ellipsd (in a, in b, in c, in n) |
Generates an ellipsoid using the equation. More... | |
function | GPoly () |
Graphical interface to create a polygon. More... | |
function | ImageOverlay (in x, in wData, in tBoxes) |
This function displays an image file and overlays text boxes. More... | |
function | IntersectPlaneAndSphere (in r, in plane, in n) |
Finds the vector giving the intersection. More... | |
function | LabelLine (in x, in t, in n, in f) |
Labels a line. More... | |
function | LabelS (in x, in y, in z, in font) |
Creates 2 or 3 axis labels. More... | |
function | LegendTitle (in name, in size) |
Add a title to the current legend. More... | |
function | LegendWithTitle (in s, in title, in varargin) |
Create a legend with a title. More... | |
function | Loc3D (in p, in u, in cM) |
Plot the location of points. More... | |
function | LogLimit (in wV) |
Given a frequency vector, find the logarithm of the frequency. More... | |
function | Map (in planet, in mType, in ignoredArg) |
Draws a 2 or 3 dimensional map of a planet. More... | |
function | Mesh2 (in xCol, in yRow, in z, in xLbl, in yLbl, in zLbl, in figTitle) |
Draws mesh plots with axis labels. More... | |
function | Mesh3DMF (in v, in vM, in fileName, in colorAtt) |
Generate a 3DMF file for a mesh. More... | |
function | MeshSOR (in fZOfR, in nTheta, in nR, in rMax) |
Create a polygonal mesh from a surface of revolution. More... | |
function | MeshToPatch (in x, in y, in z, in vIn, in fIn) |
Convert a mesh to a patch. More... | |
function | NewFig (in x, in varargin) |
Creates a new figure. More... | |
function | Normal (in v) |
Compute a normal from a set of vertices using the Newell method. More... | |
function | NPlot (in yLabels, in y, in x, in xAxisLabel, in yAxisLabel, in plotTitle, in figTitle) |
NPlot generates a plot on which the ylabels are character strings. More... | |
function | PlaybackControls (in valMin, in valMax, in val0, in callback, in dx, in name, in position) |
Create a GUI with playback controls. More... | |
function | Plot2D (in x, in y, in xL, in yL, in figTitle, in plotType, in iY, in iX, in nCols, in pThresh, in figBackColor, in leg) |
Easily build a versatile 2D plot page consisting of any number of plots. More... | |
function | Plot3D (in r, in xL, in yL, in zL, in figTitle, in rPlanet, in figBackColor) |
Create a 3-dimensional plot. More... | |
function | Plot3Vector (in time, in vector, in title) |
Plot a 3 vector as x, y, z subplots as well as a combined plot. More... | |
function | PlotAngleRange (in varargin) |
Plot one or more angular ranges on a unit circle. More... | |
function | PlotArrays (in action, in d, in varName, in varargin) |
Manage a set of arrays for plotting simulation data. More... | |
function | PlotColor (in k) |
Generate [r, g, b] for an index k = 1 to 100. More... | |
function | PlotDoubleYAxis (in x, in yL, in yR, in xLabel, in yLabelL, in yLabelR, in title, in name, in tL, in tR) |
Generates a plot with two y axes. More... | |
function | PlotF (in action, in y, in t, in g) |
Create any number of plot pages in one call. More... | |
function | PlotSet (in x, in y, in varargin) |
Create two-dimensional plots from a data set. More... | |
function | PlotV (in x, in xLbl, in yLbl, in zLbl, in figTitle) |
Draws plots of a set of 3*m-by-n vectors in 3D axes. More... | |
function | PltStyle () |
Edit this to globally change the plot styles for the plot labels. More... | |
function | Polygon (in v) |
Generate the properties for a polygon given vertices in the form v(3,n). More... | |
function | PolygonProps (in v, in f) |
Polygon properties from vertex and face data. More... | |
function | PositionLabel (in x) |
With an input in meters give a reasonable output scale. More... | |
function | PrintFig (in invertHardCopy, in printType, in f, in fName, in pathName, in zBuffer) |
Prints specified figures to a printer or files. More... | |
function | RealTimePlot (in action, in y, in t, in g) |
Plot real time. More... | |
function | Rename (in x, in f) |
Renames a figure title. More... | |
function | SetFont (in name, in size, in angle, in style) |
Sets default fonts. More... | |
function | ShowThreeImages (in x, in y, in z, in title) |
Display three images. More... | |
function | SliderBar (in valMin, in valMax, in val0, in callback, in name, in position, in fig) |
Create a slider in a new figure with continuous calls to callback. More... | |
function | SortFigs (in h, in xo) |
Sort figure windows by cascading them. More... | |
function | Splash () |
Draw a splash screen. More... | |
function | StateDisplay (in action, in varargin) |
Draw a 3D covariance display in real-time. More... | |
function | TextInBox (in pos, in s, in varargin) |
Draw text in a box. More... | |
function | TextS (in x, in y, in s, in k) |
Prints labels on a graph using text with toolbox style settings. More... | |
function | TimeHistory (in t, in y, in yL, in figTitle, in yList, in leg) |
Time history plots. More... | |
function | TimeLabel (in t0) |
Produce time labels and scaled time vectors. More... | |
function | TimeLabl (in t0, in dT) |
Generates a time label given the maximum value of t and rescales t. More... | |
function | TitleS (in x, in font) |
Creates a title using the toolbox style settings. More... | |
function | TreeDiagram (in n, in w, in update, in withTrackIDs) |
Generates a tree diagram. More... | |
function | VantagePoint (in x, in y, in A, in g, in color) |
Adds vantage points to an existing plot. More... | |
function | VelocityLabel (in v) |
With an input in meters/s give a reasonable output scale. More... | |
function | View3D (in type) |
View a plane of a 3D plot or standard cartesian view. More... | |
function | XLabelS (in x, in font) |
Creates an xlabel using the toolbox style settings. More... | |
function | YLabelS (in x, in font) |
Creates a ylabel using the toolbox style settings. More... | |
function | ZLabelS (in x) |
Creates a zlabel using the toolbox style settings. More... | |
function | EditDlg (in string, in defaultString, in waitTime) |
Creates a dialog which requires a string as an answer. More... | |
function | Figui (in h, in fs, in pos) |
User-interface to manage figure windows. More... | |
function | Finder (in action, in modifier) |
GUI to find occurrences of a text string in m-files on your MATLAB path. More... | |
function | GUIColors (in action, in modifier) |
GUI for setting interface colors. More... | |
function | InformDlg (in text, in title) |
Create an information dialog that will be dismissed by a script. More... | |
function | LegendFig (in names, in colors, in figTitle) |
Produce a new figure with just a legend of colors and names. More... | |
function | MessageQueue (in action, in modifier, in msg, in ignoredArg) |
Creates a message queue GUI. More... | |
function | MLog (in action, in text, in index) |
Message log. More... | |
function | ODETimeDisplay (in time, in ignoredArg, in action, in varargin) |
Displays an estimate of time to go, compatible with ode113. More... | |
function | Selection (in list, in msg, in name) |
Selection GUI. More... | |
function | SetCopy (in k, in w, in h) |
Set the dimensions of the figure when copied or printed. More... | |
function | StopGUI (in name) |
GUI for stopping scripts. More... | |
function | TabBox (in action, in modifier, in tabs, in content, in position, in hFig, in formatInfo, in data, in callback) |
Create a tab box from plug-ins. More... | |
function | TimeCntrl (in action) |
Perform actions specified by the time display. More... | |
function | TimeDisplay (in action, in varargin) |
Displays an estimate of time to go. More... | |
function | TimeGUI (in totalSteps, in stepsDone, in tToGoMem, in rRT, in dT, in name) |
A GUI displaying the time remaining and estimated completion time. More... | |
function | TimeToGo (in totalSteps, in stepsDone, in tToGoMem, in rRT, in dT) |
Computes the time left to go in the simulation, the predicted finish. More... | |
function | ExportToPSSMatrix (in fileName, in varargin) |
Export two dimensional matrices to a file that can be read by pss_matrix. More... | |
function | LoadSimLog (in file) |
Reads data from a simulation log file. More... | |
function | QuickPlot (in file) |
Plots output data from external simulations. More... | |
function | ReadCSVTable (in filename) |
Read in tabular data in .csv file and convert it to a structure array. More... | |
function | SFunc (in t, in x, in u, in flag) |
An example s-function that interfaces mfiles to Simulink. More... | |
function | STKAtt (in fileName, in ver, in epoch, in nPoints, in time, in attitude, in type, in seq) |
Prints attitude data to STK-formatted file. More... | |
function | STKOrbit (in fileName, in ver, in epoch, in nPoints, in time, in position, in velocity, in type) |
Prints orbit data to STK-formatted file. More... | |
function | VCFlatFile (in fileName, in time, in varargin) |
Write a set of variables to a VC flat file (comma-separated with header). More... | |
function | WriteCM (in fID, in matName, in m, in x, in nD, in nT, in nPR) |
Write a matrix for use in a C or C++ program. More... | |
function | AddMass (in mA, in mB, in u) |
Add mass properties. More... | |
function | IC623X3 (in x) |
Convert an inertia matrix from a 1x6 to a 3x3 format. More... | |
function | InertiaFromOBJFile (in fileName, in mass, in scale, in c) |
Computes an inertia matrix from an obj file or data structure. More... | |
function | Inertias (in m, in x, in type, in ignoredArg) |
Computes inertias of common objects about their c.m. More... | |
function | MassProp (in inr, in m, in cM, in u, in cName, in c) |
Compute inertia, mass and center of mass for a collection of rigid bodies. More... | |
function | MassPropertiesSolidObjFile (in fileName, in mass, in scale) |
Computes a mass properties data structure from an obj file. More... | |
function | MassPropertiesTetrahedron (in v, in rho) |
Compute inertia, volume and center of mass of a uniform tetrahedron. More... | |
function | MassStructure (in mass, in type, in info, in cM) |
Create a mass data structure. More... | |
function | PrincipalAxes (in inertia, in u) |
Computes the principal axes for an inertia matrix. More... | |
function | VFToMassStructure (in v, in f, in d) |
Computes mass properties for a component defined by vertices and faces. More... | |
function | Volumes (in x, in type) |
Computes volumes of common objects about their c.m. More... | |
function | AtomicMass (in atom, in units) |
Outputs atomic mass in kg or amu. More... | |
function | CPGas (in t, in gas) |
Thermal capacity for a gas as a function of temperature. More... | |
function | GasProperties (in gas) |
Returns gas properties. More... | |
function | PoissonsRatio (in material) |
Returns Poisson's ratio. More... | |
function | ComputeGainsPlugIn (in action, in modifier, in hFig, in position, in callback) |
Create a detection filter gains GUI plug in used by DetectionFilterBuilder. More... | |
function | HierarchicalListPlugIn (in action, in modifier, in hFig, in position, in callback, in params) |
Create and manages a hierarchical list. More... | |
function | NormalizePlugIn (in action, in modifier, in hFig, in position, in callback) |
Create the Normalize GUI plug in used by DetectionFilterBuilder. More... | |
function | PlotPlugIn (in action, in modifier, in hFig, in position) |
Plot a variable number of points. More... | |
function | SimulatePlugIn (in action, in modifier, in hFig, in position, in callback) |
Create a Simulate GUI plug in used by DetectionFilterBuilder. More... | |
function | StateSpacePlugIn (in action, in modifier, in hFig, in position, in callback) |
Create an StateSpace GUI plug in used by DetectionFilterBuilder. More... | |
function | Telemetry (in action, in modifier, in u, in v) |
Generates a GUI with a set of telemetry pages. More... | |
function | TelemetryOffline (in action, in modifier) |
This GUI plots telemetry files previously saved by Telemetry. More... | |
function | TelemetryPlot (in action, in modifier, in u) |
Plot real time data in a single window. More... | |
function | TimePlugIn (in action, in modifier, in hFig, in position, in callback) |
Create a time GUI plug in. More... | |
function | HoopStress (in r, in p, in sigma, in type) |
Computes the thickness of a pressure vessel. More... | |
function | MassPressureVessel (in d, in t, in rho, in type) |
Computes the mass of a pressure vessel. More... | |
function | Anim2Q (in q, in speed, in h, in propName, in propValue) |
Animate the evolution of 2 quaternions over time. More... | |
function | AnimQ (in q, in speed, in h, in propName, in propValue) |
Animate the evolution of a quaternion over time. More... | |
function | AU2Q (in angle, in u) |
Convert an angle and a unit vector to a quaternion. More... | |
function | DeltaQToRate (in q1, in q2, in dT) |
Angular rate from small quaternion changes. More... | |
function | DQ2Mat (in q, in qDot) |
Finds the derivative of a transformation matrix in terms of quaternions. More... | |
function | Mat2Q (in m) |
Converts a transformation matrix to a quaternion. More... | |
function | Q2AU (in q) |
Convert a quaternion to an angle and a unit vector. More... | |
function | Q2Eul (in q, in e) |
Converts a quaternion to 3-2-1 Euler angles. More... | |
function | Q2Mat (in q) |
Converts a quaternion to a transformation matrix. More... | |
function | QAxisRot (in qi, in angle, in u) |
Creates a quaternion based on a pure rotation about the any axis. More... | |
function | QBToIDot (in q, in w, in dT) |
Computes the quaternion derivative from angular velocity. More... | |
function | QError (in qRef, in qMeas, in ignoredArg) |
Small angle errors between two quaternions. More... | |
function | QForm (in q, in ua) |
Transforms a vector in the direction of the quaternion. More... | |
function | QFromDQ (in q, in dQ24) |
Computes a quaternion from a base quaternion and delta quaternion. More... | |
function | QMult (in Q2, in Q1) |
Multiply two quaternions. More... | |
function | QPose (in q) |
Transpose of a quaternion. More... | |
function | QRand (in n) |
Generates random quaternions. More... | |
function | QTForm (in q, in ua) |
Transforms a vector opposite the direction of the quaternion. More... | |
function | QUnit (in q) |
Unitizes a quaternion. More... | |
function | QZero () |
Outputs the zero quaternion, [1;0;0;0]. More... | |
function | Sa2Q (in av) |
Converts an angle vector into a quaternion. More... | |
function | U2Q (in u, in v) |
Finds the quaternion that aligns a unit vector with a second vector. More... | |
function | ReliabilityMOfN (in m, in n, in mTBF, in t) |
Determine the reliability of a system. More... | |
function | ReliabilityParallel (in n, in mTBF, in t) |
Determine the reliability of a parallel system. More... | |
function | ReliabilitySeries (in n, in mTBF, in t) |
Determine the reliability of a series system. More... | |
function | Date2DN (in datetime) |
Compute the day number from the date. More... | |
function | Date2FY (in datetime) |
Computes the fractional year from the date. More... | |
function | Date2JD (in datetime) |
Compute the Julian Date from the date. More... | |
function | DateStringToJD (in s) |
Convert a date string to Julian date. More... | |
function | DeltaT (in jd) |
Computes the difference between UT1 and TT based on the Julian date. More... | |
function | DN2Date (in dN, in year) |
Computes the date from the day number and year. More... | |
function | DN2JD (in dN, in year) |
Computes the Julian Date from the day number and year. More... | |
function | DNString2Date (in s) |
Converts a day number string to a date. More... | |
function | DTAToDTS (in t) |
Converts the date time array to the date time structure. More... | |
function | DTSToDTA (in t) |
Converts the date time structure to the date time array. More... | |
function | FindSolsticeOrEquinox (in type, in year) |
Finds the Julian Date for solstices and equinoxes. More... | |
function | JD2000 () |
Returns the Julian Date for J2000.0 0d 0h UT. More... | |
function | JD2Array (in jD0, in t) |
Compute an array of Julian dates from an epoch. More... | |
function | JD2Date (in jd, in structOut) |
Compute the calendar date from the Julian date. More... | |
function | JD2Day (in jD) |
Computes the day of the week from Julian day number. More... | |
function | JD2DN (in jD) |
Compute the day number from Julian date. More... | |
function | JD2MJD (in jD) |
Converts Julian date to Modified Julian Date. More... | |
function | JD2T (in jd) |
Converts Julian days to centuries from J2000.0. More... | |
function | JDToDateString (in jD, in ignoredArg) |
Convert Julian Date to the form '04/20/2000 00:00:00'. More... | |
function | JDToMidnight (in jD) |
Converts a Julian date to the nearest midnight. More... | |
function | LeapYear (in datetime) |
Determines if a year is a leap year. More... | |
function | LocalTimeToGMT (in dateTime, in lon) |
Compute the Julian Date from the local time. More... | |
function | LocalTimeToJD (in dateTime, in lon) |
Compute the Julian Date from the local time. More... | |
function | MJD2JD (in mJD) |
Converts Modified Julian Date to Julian date. More... | |
function | SecToString (in s) |
Convert seconds to days hours/min/seconds and produces a string. More... | |
function | SystemTime (in action, in mET, in jD) |
Provides the system time to the software. More... | |
function | T2JD (in T) |
Converts Julian centuries from J2000.0 to days. More... | |
function | TAI2TT (in tAI) |
Converts Terrestrial atomic time to Terrestrial dynamic time. More... | |
function | TDB2TT (in tDB, in jD) |
Converts barycentric dynamical time. More... | |
function | TimeStringToJD (in s) |
Convert a time string to Julian date. More... | |
function | TT2TAI (in tT) |
Converts Terrestrial (dynamic) time to Terrestrial atomic time. More... | |
function | TT2TDB (in tT, in jD) |
Converts terrestrial dynamic time to barycentric dynamical time. More... | |
function | TT2UT1 (in jDTT) |
Converts TT (Terrestrial (dynamic) Time) to UT1. More... | |
function | UT12TT (in jDUT1) |
Converts UT1 (time scale based on the rotation of the earth) More... | |
function | YPF2T (in y) |
Converts years in fractional form, e.g. More... | |
function | Altitude (in r, in f, in a, in units) |
Computes the altitude above an ellipsoidal planet. More... | |
function | AU2M (in angle, in u) |
Convert an angle and a unit vector to a matrix. More... | |
function | Cart2Sph (in x, in y, in z) |
Converts cartesian coordinates to spherical. More... | |
function | CoordinateFrameFromUV (in u) |
Computes a transformation matrix from the frame. More... | |
function | Deg2DMS (in a) |
Convert degrees to degrees, minutes and seconds. More... | |
function | Deg2HMS (in a) |
Convert radians to hours, minutes and seconds. More... | |
function | DMS2Deg (in d, in m, in s) |
Convert degrees, minutes and seconds to radians. More... | |
function | DMS2Rad (in d, in m, in s) |
Convert degrees, minutes and seconds to radians. More... | |
function | Eul2Mat (in e) |
Converts 3-2-1 Euler angles into an orthonormal transformation matrix. More... | |
function | Eul2Q (in e) |
Converts 3-2-1 Euler angles to a quaternion. More... | |
function | EulDot2Rates (in e, in wEul, in n) |
Converts 3-2-1 Euler angle rates into angular velocity. More... | |
function | HMS2Deg (in h, in m, in s) |
Convert hours, minutes and seconds to degrees. More... | |
function | HMS2Rad (in h, in m, in s) |
Convert hours, minutes and seconds to radians. More... | |
function | IConv (in IVec) |
Transform a 6x1 compact inertia vector into a 3x3 inertia matrix. More... | |
function | IConvP (in IMat) |
Transform a a 3x3 inertia matrix into 6x1 compact inertia vector. More... | |
function | Mat2Eul (in m, in e) |
Converts an orthonormal transformation matrix into 3-2-1 Euler angles. More... | |
function | Rad2DMS (in a) |
Convert radians to degrees, minutes and seconds. More... | |
function | Rad2HMS (in a) |
Convert radians to hours, minutes and seconds. More... | |
function | RaDec2U (in rA, in dec) |
Converts right ascension and declination to unit vectors. More... | |
function | Rates2EulDot (in e, in w, in n) |
Converts angular velocity into 3-2-1 Euler angle rates. More... | |
function | RotMat (in angle, in axis) |
Generates a rotation matrix that transforms in the opposite direction. More... | |
function | RPhiTheta2Cart (in r) |
Computes the transformation matrix from an r, phi, theta frame. More... | |
function | Sph2Cart (in r, in theta, in phi) |
Converts spherical coordinates to cartesian. More... | |
function | TranslateAxes (in i, in r, in m, in sgn) |
Recompute the moment of inertia "i" by translating axes. More... | |
function | UnitVectorFromOffset (in v1, in v2, in cone, in clock) |
Computes a unit vector offset from v2 with origin at v1. More... | |
function | VM2Int (in v) |
Converts apparent visual magnitude to intensity in watts/m^2. More... | |
The Common module functions. View the published Common Demos.
The Common module contains many useful utilities that are used across our product line.
function Acker | ( | in | a, |
in | b, | ||
in | p | ||
) |
Gains for poles using Ackermann's formula.
Computes the gain for desired pole locations using Ackermann's formula so that a-bk has the desired poles.
k = Acker( a, b, p )
a Plant matrix b Input matrix p Pole locations
k Gain
References: Franklin, G., J.D. Powell, M.L. Workman (1992). Digital
Control of Dynamic Systems. John Wiley & Sons, New York 245.
function ACTF | ( | in | e | ) |
Generic sensor or actuator model.
The model is
x exp(-delay*s) - = ----------------------------------- u (s^2 + 2*zeta*w + w^2)*(tau*s + 1 )
Any term may be omitted. Uses a 2nd order delay model.
g = ACTF( e )
e (n) Sensor data structure .delay .tau .zeta .w .name Name of the device
g (:) Sensor state space model of type statespace
function AddAxes | ( | in | m, |
in | r, | ||
in | T, | ||
in | h, | ||
in | c, | ||
in | label | ||
) |
Adds x,y,z coordinate axes to a figure.
Specify the size, location, and orientation of the axes. A label may be given which will be prepended to the axis labels (X,Y,Z).
[h,q] = AddAxes( m, r, T, h, c, label )
m (1) Length of all coordinate axes (optional, default 1) r (3,1) Vector indicating the origin of the axes (optional, default [0;0;0] ) T (3,3) Transformation matrix (optional, default identity) Note: a quaternion may be supplied instead h (1) Figure handle (optional) c (1) Color scheme for x, y, z 1 - Blue, Green, Red 2 - Black, Cyan, Magenta or a single color, 'r', 'b' (optional, default 1) label (:) Text label to add to axes labels
h (1) Figure handle q (.) Struct of graphics handles
function AddDeltaModeToPlot | ( | in | hAxis, |
in | oldMode, | ||
in | newMode, | ||
in | t, | ||
in | x | ||
) |
function AddFillToPlots | ( | in | time, |
in | data, | ||
in | h, | ||
in | colors, | ||
in | alpha | ||
) |
Find mode changes in data and draw as filled sections on existing plots.
Time and data must be the same size. diff will be used to find the points where the value of data changes. Each segment will then be assigned a background color from colors. The 'auto' colors mode used the axes color order property. If a figure handle is not specified the current figure is used.
Type AddFillToPlots for a demo.
AddFillToPlots(time,data,h,colors,alpha)
time (1,n) Time axis data (the same for all subplots) data (1,n) Data containing the mode changes h (1,1) Figure handle with plots colors (n,3) or 'auto' Colors for fill patches alpha (1,1) facealpha property for the patch, in range [0 1]
None.
function AddMass | ( | in | mA, |
in | mB, | ||
in | u | ||
) |
Add mass properties.
mB is optional. mA and/or mB may be arrays of data structures.
Typing AddMass returns the default data structure.
m = AddMass( mA, mB, u )
mA (:) Mass data structure .mass (1,1) Mass .cM (3,1) Center-of-mass .inertia (3,3) Inertia matrix about CM mB (:) Mass data structure .mass (1,1) Mass .cM (3,1) Center-of-mass .inertia (3,3) Inertia matrix about CM u (1,:) Units
m (:) Mass data structure .mass (1,1) Mass .cM (3,1) Center-of-mass .inertia (3,3) Inertia matrix
function AddOuterLoop | ( | in | gInner, |
in | gOuter, | ||
in | e | ||
) |
Add an outer loop for a controller.
Type AddOuterLoop for a demo.
g = AddOuterLoop( gInner, gOuter, e )
gInner (1,1) Inner loop plant gOuter (1,1) Outer loop plant e (n,m) Outer to inner loop matrix (m outputs from outer loop to n inputs)
g (1,1) The complete statespace controller
function AddToList | ( | in | h, |
in | s, | ||
in | n | ||
) |
function AddToPath | ( | in | dirName | ) |
function AddView | ( | in | h | ) |
function AddZoom | ( | in | h | ) |
function AggregateComponents | ( | in | c, |
in | scale | ||
) |
Aggregate CAD component vertices and faces.
This is useful with external models with many components. Once you aggregate them you can rotate and translate the assembly.
Type AggregateComponents for a demo with a Box and a Frustrum.
[v,f] = AggregateComponents(c)
c (:) Data structure array of components .v (:,3) Vertices .f (:,3) Faces scale (1,1) Scale factor for the vertices
v (:,3) Vertices, combined from the components f (:,3) Faces
function Alias | ( | in | w, |
in | ws | ||
) |
function AllanVariance | ( | in | x, |
in | t | ||
) |
Implements the overlapping Allan Variance.
Type AllanVariance for a demo. The simulation takes a long time.
aD = AllanVariance(x,t)
x (1,:) Data t (1,:) Time vector
aD (1,:) Allan deviation a (1,:) Allan variance tAv (1,:) Averaging times
Reference: Freescale Semiconductor "Allan Variance: Noise Analysis for Gyroscopes, Application Note," Document Number: AN5087, Rev. 0. 2/2015.
function AllCaps | ( | in | s | ) |
function Altitude | ( | in | r, |
in | f, | ||
in | a, | ||
in | units | ||
) |
function AnglePatch | ( | in | v1, |
in | v2, | ||
in | z, | ||
in | c, | ||
in | f | ||
) |
Draw a patch showing the inner angle between two vectors.
Enter a rotation axis if the angle may be more than 180 degrees.
AnglePatch( v1, v2, z, c, f )
v1 (3,1) First vector v2 (3,1) Second vector z (3,1) Rotation axis, optional c (:) Color code, 'g', 'r', etc f (1,1) Saturation, between 0 and 1
none
function AngleSensor | ( | in | x, |
in | d | ||
) |
Angle sensor.
The inputs are the one dimensional state vector [x;v] and a data structure with the baseline and noise. The sensor tracks the target.
theta = AngleSensor( x, d )
x (2,1) [x;v] d (1,1) Data structure .b (1,1) Baseline .noise (1,1) Angle noise (rad)
theta (1,1) Angle measurement
function Anim2Q | ( | in | q, |
in | speed, | ||
in | h, | ||
in | propName, | ||
in | propValue | ||
) |
Animate the evolution of 2 quaternions over time.
Anim2Q( q, speed, h, propName, propValue )
q (8,:) Time history of two quaternions speed (1) Speed factor (0 slow - 100 fast) h (1) Handle of the figure to animate in (optional) propName {:} Array of property names ie, {'linewidth','linestyle'} propValue {:} Array of property values ie, {2,'--'}
none
function AnimateCube | ( | in | action, |
in | modifier, | ||
in | x | ||
) |
Draw a cube given its dimensions.
The color scheme for the x/y/z faces is blue, green, red, following the default MATLAB color order.
AnimateCube( action, modifier, x ) AnimateCube( 'run', dim, q ) tag = AnimateCube( 'initialize', dim ) AnimateCube( 'update', tag, q )
action (1,:) 'initialize', 'update', 'close' modifier (1,:) [x,y,z] dimensions on initialize or tag otherwise x (4,1) Quaternion (used for update/run only), or (5,1) if a time is appended.
tag (1,1) Returned on initialize
See also AddAxes.
function AnimateVectors | ( | in | varargin | ) |
function Animator | ( | in | fig, |
in | data, | ||
in | background, | ||
in | style, | ||
in | markersize, | ||
in | linewidth | ||
) |
Animate a set of 2xN or 3xN matrices over N steps.
After initializing, use the "Animate" menu in the figure to play the animation. For example:
t = linspace(0,10,200); r = [sin(t);cos(t);t/10]; Animator( [], r );
[fh,ph,bh] = Animator( fig, data, background, style, markersize, linewidth )
fig (1) Figure handle for the plot. If empty, a new figure is created. data (M,N) Data to be animated M = 2 or 3. N = # samples. background (1) Flag. Plot the trajectory as a background? style (:) String indicating color, linestyle, marker For example: 'r:x'. Must be in this order. markersize (1) The marker size to use for the animated point linewidth (1) The line width to use for the background line
fig (1) Figure handle for the plot. If empty, a new figure is created. data {K} Cell array with K sets of data. background (1,K) Array of K background flags. style {K} Cell array of K style strings. markersize (K) Array of K marker sizes linewidth (K) Array of K line widths NOTE: If a single property (background, style, etc.) is supplied when there are multiple data sets, then that same property is used for all data sets.
fh (1) Figure handle ph (1,K) Point handle bh (1,K) Background handle mh (1,3) Menu handles
function AnimQ | ( | in | q, |
in | speed, | ||
in | h, | ||
in | propName, | ||
in | propValue | ||
) |
Animate the evolution of a quaternion over time.
Type AnimQ for a demo.
h = AnimQ( q, speed, h, propName, propValue )
q (4,:) Time history of quaternion speed (1) Speed factor (0 slow - 100 fast) h (1) Handle of the figure to animate in (optional) propName {:} Array of property names ie, {'linewidth','linestyle'} propValue {:} Array of property values ie, {2,'--'}
h (1,1) Figure handle
function Append | ( | in | a1, |
in | b1, | ||
in | c1, | ||
in | d1, | ||
in | a2, | ||
in | b2, | ||
in | c2, | ||
in | d2 | ||
) |
Appends two state space systems.
Appends two state space models assuming that they do not have any inputs, states or outputs in common.
[a, b, c, d] = Append( a1, b1, c1, d1, a2, b2, c2, d2 )
a1 Plant matrix b1 Input matrix c1 Measurement matrix d1 Input feedthrough matrix a2 Plant matrix b2 Input matrix c2 Measurement matrix d2 Input feedthrough matrix
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix
function ArrayToLinspace | ( | in | x | ) |
function Arrow3D | ( | in | r, |
in | l, | ||
in | g, | ||
in | u, | ||
in | c, | ||
in | alpha, | ||
in | hA | ||
) |
Draws a 3D arrow into an existing figure.
You need to create a figure to draw it into such as: NewFig('3D Arrow');
Type Arrow3D for a demo showing cartesian axes.
h = Arrow3D(r,l,g,u,c,alpha,hA) % initialize Arrow3D(h,g,u) % update arrow's location
r (1,1) Radius l (1,1) Length g (3,1) Origin u (3,1) Unit vector c (1,3) Color [r g b], each element 0 to 1 alpha (1,1) Transparence 0 to 1 hA (1,1) Handle to axies
h (1,1) Handle to patch object
function AssembleBlock | ( | in | x | ) |
Assemble a block given the data structure.
x .g (1,1) Complete block model of class statespace .gBase (1,1) Base model (cannot be separated into SISO elements) .sISOID (1,1) ID of SISO element (not used here) .sISO (:) .g (1,1) Controller statespace representation .name (1,:) Controller name .element {:} Controller type .parameters {:} Controller parameters .inputs {:} Inputs .outputs {:} Outputs
You can add parallel systems, or add at the input and output. You can only do the latter two if x.g is not empty. It will add at the input or output if the input and output names of the SISO are the same and they match the systems input or output names.
x = AssembleBlock( x )
x (1,1) Data structure defined above
x (1,1) Data structure defined above
function AssemblePlant | ( | in | gIn, |
in | e, | ||
in | in, | ||
in | openLoop | ||
) |
Assemble a plant given a model described by gIn.
If open loop the output is the output of the sensor. Otherwise it is the states of the plant.
gIn is a data structure with models for command, control, the plant and the sensors.
gIn.gCommand gIn.gControl gIn.gPlant gIn.gSensor
where each field is a statespace class.
e is a data structure with indices giving connections between the blocks:
e.commandToControl (output of the command block to the input of the control block) e.controlToPlant (output of the control block to the input of the plant block) e.plantToSensor (output of the plant block to the input of the sensor block) e.sensorToControl (output of the sensor block to the input of the control block)
where each field is a matrix that defines the connection between the input of the first and the output of the second. For example [1 1] means first output into first input.
See series (not Series) for more information about connections.
g = AssemblePlant( gIn, e, in, openLoop )
gIn (:) .gCommand .gControl .gPlant .gSensor e (.) Datastructure .commandToControl .controlToPlant .plantToSensor .sensorToControl in (1,:) 'noise', 'disturbance', 'command' openLoop (1,1) If 1 generate the open loop plant
gC (1,1) The complete statespace plant
function AssignColors | ( | in | n, |
in | sat, | ||
in | val | ||
) |
Choose n colors from around the RGB color wheel.
Saturation: reducing the saturation lightens the colors while remaining on the same "spoke" of the color wheel. A saturation of 0 produces all grays.
Value: ratio between RGB components remains the same, but overall magnitude drops to make colors darker. ex. [1 0.85 0] and [0.684 0.581 0]
colors = AssignColors( n, sat, val )
n (1,1) Number of colors sat (1,1) Saturation (from 0 to 1) val (1,1) Value (from 0 to 1)
colors (n,3) Matrix of RGB colors
See also hsv2rgb, ColorSpread
function AssignFHandle | ( | in | fName | ) |
function AtomicMass | ( | in | atom, |
in | units | ||
) |
function AttitudeCoordinates | ( | in | varargin | ) |
function AU2M | ( | in | angle, |
in | u | ||
) |
function AU2Q | ( | in | angle, |
in | u | ||
) |
function AxesCart | ( | in | xMin, |
in | yMin, | ||
in | zMin | ||
) |
function Axis3D | ( | in | s | ) |
function AxisEqual | ( | in | axisHandle, |
in | minSize, | ||
in | dim | ||
) |
Equalize the axes with a minimum relative size for the smallest axis.
AxisEqual( axisHandle, minSize, dim );
axisHandle (1,1) Handle to the axis minSize (1,1) Minimum size of smallest axis, expressed as a percentage of the maximum axis size. Optional. Default is 0.1. dim (1,1) Dimension (2 or 3). Optional. Default is 3.
none
function BalReal | ( | in | a, |
in | b, | ||
in | c, | ||
in | d | ||
) |
Compute the balanced realization of a, b, c, d.
[a, b, c, d, t, g, err] = BalReal( a, b, c, d )
a State matrix b Input matrix c Output matrix d Feedthrough matrix
a State matrix b Input matrix c Output matrix d Feedthrough matrix t Transformation matrix g The observability and controllability grammiam err Error
function BalRealG | ( | in | g | ) |
Computes a balanced realization of g.
The same as BalReal except for a state space class.
[g, t, gram, err] = BalRealG( g )
g (:) Plant model of type statespace
g (:) Augmented plant t (:) Transformation matrix gram (:) The observability and controllability grammiam err (1,1) Error
function BarPlot | ( | in | x, |
in | y | ||
) |
function BlockDiagramPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create a BlockDiagram GUI plug in.
Type BlockDiagramPlugIn for a demo.
x = BlockDiagramPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function BodeGP | ( | in | g, |
in | w | ||
) |
function Box | ( | in | x, |
in | y, | ||
in | z, | ||
in | openFace | ||
) |
Generate a box centered at the origin.
The open face is a character string:
-x, +x, -y, +y, -z, +z
Type Box for a demo.
[v, f] = Box( x, y, z, openFace )
x (1,1) x length y (1,1) y length z (1,1) z length openFace (1,2) Which face is open (optional)
v ( 8,3) Vertices f (12,3) Faces
function BoxWithRoundedSection | ( | in | x, |
in | y, | ||
in | z | ||
) |
function BuildConstant | ( | in | name | ) |
function C2DelZOH | ( | in | a, |
in | b, | ||
in | T | ||
) |
Create a discrete time systems using the delta operator.
Given . x = ax + bu Find f and g where x(k+1) = x + fx(k) + gu(k)
[f, g] = C2DelZOH( a, b, T )
a (n,n) Continuous plant matrix b (n,m) Input matrix T (1,1) Time step
f (n,n) Discrete plant matrix g (n,m) Discrete input matrix
References: Van Loan, C.F., Computing Integrals Involving the Matrix Exponential, IEEE Transactions on Automatic Control Vol. AC-23, No. 3, June 1978, pp. 395-404.
Middleton, R.H. and G.C. Goodwin, Digital Control and Estimation: A Unified Approach, Prentice-Hall, 1986
function C2DFOH | ( | in | a, |
in | b, | ||
in | T | ||
) |
Create a discrete time system using a first order hold.
Create a discrete time system from a continuous system assuming a first-order-hold at the input. Given . x = ax + bu
[f, g] = C2DFOH( a, b, T )
a (n,n) Continuous plant matrix b (n,m) Input matrix T (1,1) Time step
f (n,n) Discrete plant matrix g (n,m) Discrete input matrix
function C2DPulse | ( | in | a, |
in | b, | ||
in | T, | ||
in | tau | ||
) |
Create a discrete time system assuming a pulse at the input.
Create a discrete time system from a continuous system assuming a pulse at the input. Given . x = ax + bu Find f and g where x(k+1) = fx(k) + gu(k)
[f, g] = C2DPulse( a, b, T, tau )
a (n,n) Continuous plant matrix b (n,m) Input matrix T (1,1) Time step
f (n,n) Discrete plant matrix g (n,m) Discrete input matrix
References: Van Loan, C.F., Computing Integrals Involving the Matrix
Exponential, IEEE Transactions on Automatic Control Vol. AC-23, No. 3, June 1978, pp. 395-404.
function C2DZOH | ( | in | a, |
in | b, | ||
in | T | ||
) |
Create a discrete time system using a zero order hold.
Create a discrete time system from a continuous system assuming a zero-order-hold at the input. Given . x = ax + bu Find f and g where x(k+1) = fx(k) + gu(k)
[f, g] = C2DZOH( a, b, T )
a (n,n) Continuous plant matrix b (n,m) Input matrix T (1,1) Time step
f (n,n) Discrete plant matrix g (n,m) Discrete input matrix
References: Van Loan, C.F., Computing Integrals Involving the Matrix Exponential, IEEE Transactions on Automatic Control Vol. AC-23, No. 3, June 1978, pp. 395-404.
function C2DZOHWD | ( | in | a, |
in | b, | ||
in | c, | ||
in | T, | ||
in | Td | ||
) |
Create a discrete time system using a zero order hold and delay.
Create a discrete time system from a continuous system assuming a zero-order-hold at the input with a delay. Given . x = ax + bu y = cx Find f and g where x(k+1) = fx(k) + gu(k) y = cx(k) + du(k) The delay is defined as Td = l*T - m*T where l is always the least integer number of sampling periods greater than the delay.
[f, g, c, d, l, m] = C2DZOHWD( a, b, c, T, Td )
a Plant matrix b Input matrix c Output matrix T Time step Td The delay
f Discrete plant matrix g Discrete input matrix c Output matrix d Feedthrough matrix l Number of integral period delays m Fractional delay
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control
of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, pp. 56-61.
function CameraControls | ( | in | varargin | ) |
This function creates a GUI for manipulating the camera view.
Initialize by supplying an axis handle. If no input is provided it will point to the current axis (gca).
This GUI does not provide direct control over the camera target. Set the camera target of axes "h" to vector "v" with this command:
set(h,'cameratarget',v)
Move in/out changes the distance from the camera to the target. Zoom in/out changes the view angle of the camera. Adjust azimuth and elevation to change the orientation of the camera
while keeping the distance constant.
The azimuth and elevation angles are defined in a local xyz coordinate frame.
x: along the direction of the camera target vector. y: cross product of z and x, completes right-handed system z: cross product of x and the supplied forward vector
Note that the "forward" vector is not an axis property, and so it must be supplied directly to the CameraControls GUI.
USAGE:
% Initialize and use current axes (gca) tag = CameraControls; % Initialize with specified axes tag = CameraControls( axisHandle ); % Set the forward vector CameraControls( 'set forward vector', tag, forwardVector ); % Update the view CameraControls( 'update', tag ); % Update the view with a new forward vector CameraControls( 'update', tag, forwardVector );
axisHandle (1,1) Handle to the axes for controlling the camera
tag (1,:) Tag to the GUI.
See also: AnimationGUI
function Cart2Sph | ( | in | x, |
in | y, | ||
in | z | ||
) |
function CButter | ( | in | n, |
in | wC, | ||
in | tSamp, | ||
in | sType | ||
) |
Create a continuous Butterworth Filter.
Build a continuous Butterworth Filter with output of the form
dx/dt = ax + bu y = cx + du
If no outputs are specified it will plot the frequency response
[a, b, c, d] = CButter( n, wC, tSamp, sType )
n (1,1) Order wC (1,1) Cutoff tSamp (1,1) Sampling frequency sType (1,:) State equation type ('Delta' or 'Z')
a State transition matrix b Input matrix c Measurement matrix d Feedthrough matrix
function CCVModel | ( | in | q | ) |
Generate CCV (control configured vehicle) aircraft model.
This is useful for trying out the control functions Type CCVModel for a demo.
x = CCVModel( q )
q (1,:) String describing the type of data Use 'catalog' to print list of supported types
x The properties
Reference: Stevens, B.L., Lewis, F.L. , Aircraft Control and Simulation, John Wiley & Sons, 1992, pp. 354-358.
See also @statespace/statespace.m, EigEval, SVPlot, Step
function CDKF | ( | in | d, |
in | fName, | ||
in | hName | ||
) |
Continuous discrete iterated extended Kalman Filter.
The state and covariance matrices are numerically integrated. The model is of the form:
dx/dt = f(x,t,u) y = h(x,t,u) F(x,t,u) = df/dx H(x,t) = dh/dx
x is the estimated state. Name is a function of the form:
[xDot, d.fData] = fName( x, t, d.fData )
hName is a function of the form:
[z, dhdx] = hName( x, t, d.hData, d.meas.k )
If dhdx is empty, CDKF will linearize hName about x and t. k are the indices to the measurements for which there is data.
d = CDKF( d, fName, hName )
d (:) Data structure .time Time or jD .year .month .day .hour .minute .second .timeLast Time of last call .secFromStart Seconds from start .x State .p Covariance .q Plant noise matrix .k Gain matrix .r Measurement noise matrix .nIterations Number of iterations .meas Measurements .z New measurement(s) .k Indices of new measurement(s) .fData f function data (user defined) .hData h function data (user defined) fName (1,:) Dynamics function name hName (1,:) Measurement function name
d (:) Data structure
References: Gelb, A. Ed., Applied Optimal Estimation, MIT Press. p.188. Table 6.1-1. Also, pp. 190-191.
function Cell2DToStruct | ( | in | y, |
in | m | ||
) |
Convert a structure into a cell array where columns of the array.
include both values and fieldnames. For example, the cell
a 1 b c 2 b d 3
Becomes
x.a = 1 x.b.c = 2; x.b.d = 3;
The companion array m is
1 0 0 1 1 0
1 1 0
Where a 1 indicates that the cell is a field name. Where a 1 indicates that the cell is a field name.
x = Cell2DToStruct( y, m )
y (:) Cell Array
x (:) Structure
function CellToMat | ( | in | c | ) |
function CenterFigure | ( | in | width, |
in | height | ||
) |
function Centroid | ( | in | v | ) |
function CGram | ( | in | a, |
in | b | ||
) |
function ChangePath | ( | in | newPath | ) |
function CInputs | ( | in | t, |
in | tStart, | ||
in | d, | ||
in | type | ||
) |
Generates different control inputs.
d is the data pulse doublet: d.init, d.dT, d.magnitude step: d.init, d.magnitude ramp: d.init, d.slope d.init is the initial u d.dT is the duration of the pulse d.magnitude is the magnitude of the pulse d.slope is the slope
u = CInputs( t, tStart, d, type )
t (1,1) Time tStart (1,1) Time to start d (:) Data type (1,:) Type 'pulse', 'doublet', 'ramp', 'step'
u (1,1) Output
function Circle | ( | in | r, |
in | xc, | ||
in | yc, | ||
in | n | ||
) |
function CLoopS | ( | in | a, |
in | b, | ||
in | c, | ||
in | ac, | ||
in | bc, | ||
in | cc, | ||
in | dc | ||
) |
Creates a closed loop system.
Creates a closed loop system given the plant [a,b,c] and the controller [ac,bc,cc,dc]. Every output of the controller has a corresponding input in the plant and yc(i) = u(i), etc.
[at, bt, ct, dt] = CLoopS( a, b, c, ac, bc, cc, dc ) [at, bt, ct, dt] = CLoopS( a, b, c, k )
a (2n,2n) Plant matrix b (2n, n) Input matrix c ( n,2n) Output matrix ac (2n,2n) Controller plant matrix bc (2n, n) Controller input matrix cc ( n,2n) Controller output matrix dc ( n, n) Controller feedthrough matrix or k ( n, n) Gain matrix
at (2n,2n) System plant matrix bt (2n, n) System input matrix ct ( n,2n) System output matrix dt ( n,2n) System feedthrough matrix
function CloseFigure | ( | in | h | ) |
function CloseIfHandle | ( | in | h | ) |
function CloseMatFile | ( | in | kOpenPre | ) |
function CloseUIElement | ( | in | h | ) |
function CLPoles | ( | in | a, |
in | b, | ||
in | c, | ||
in | f, | ||
in | g, | ||
in | h, | ||
in | k | ||
) |
Computes the closed loop poles.
Computes the closed loop poles for a control system z = f*z - g*y u = h*z - k*y The plant is assumed to be in the form x = a*x + b*u y = c*x Automatically reduces the order of the system.
z = CLPoles( a, b, c, f, g, h, k )
[a,b,c] Plant matrices [f,g,h,k] Controller matrices
z Closed loop poles
function ColorMapGrayScale | ( | ) |
function ColorSpread | ( | in | n, |
in | map | ||
) |
Produce a set of 3-element RGB colors that spread across the colormap.
If a map is not specified it will grab the default figure color map.
colors = ColorSpread( n, map )
n (1,1) Number of colors to produce map (:,3) Colormap, optional
colors (n,3) n rows of colors
See also AssignColors
function ColumnSizeCellArray | ( | in | m, |
in | f | ||
) |
function CompE | ( | in | x, |
in | sType, | ||
in | dT | ||
) |
Create a SISO compensator using a variety of compensator elements.
Each element of d is a data structure which contains the parameters of the particular compensator. Element Type Underlying Function -------------------- ------------------- 'butterworth filter' CButter 'delay' Delay 'general second order' Gen2nd 'integral' Integral 'lead-lag' LeadLag 'notch' Notch 'pilot' Pilot 'pulsewidth modulator' PWM 'shaping filter' ShapeFlt 'washout' ND2SS( [1 0], [1 w] ); 'zero order hold' ZOH
g = CompE( x, sType, dT )
x (n) Compensator element data structure .type .name .... (different for each element type) sType (1,:) State space type, 'delta', 'bilinear', 'zoh', 'forward', 'backward' dT (1,1) Time step
g (:) Compensator
function ComputeGainsPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create a detection filter gains GUI plug in used by DetectionFilterBuilder.
x = ComputeGainsPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function Cone | ( | in | p, |
in | u, | ||
in | halfAngle, | ||
in | l, | ||
in | n | ||
) |
Compute the vertices for a cone.
The cone emanates from p and points in direction u. If no outputs are specified the cone will be drawn in a new figure.
Type Cone for a demo.
[v, f] = Cone( p, u, halfAngle, l, n)
p (3,1) Location of apex u (3,1) Cone axis unit vector halfAngle (1,1) Cone half angle (rad) l (1,1) Length of cone n (1,1) Number of divisions
v (:,3) Vertices f (:,3) Faces
function Constant | ( | in | q, |
in | gUICode | ||
) |
Outputs the value of a constant or opens a GUI for searching.
q must be an exact match. Case and spaces have no effect. To search for a string (without using the GUI) type
Constant( searchString, 'find' )
Loads either sCTConstants.mat or, if not found, ACTConstants.mat.
[x, u] = Constant( q, gUICode )
q (1,:) String describing the constant gUICode (1,:) GUI code
x (1,1) The value u (1,:) Units (if applicable)
Referenced by CreateGUI().
function ControlDesignGUI | ( | in | action, |
in | modifier, | ||
in | u | ||
) |
Design control systems using a GUI.
This GUI maintains a data structure for the system that is modeled. The data structure is
h.x .g (1,1) Complete plant model of class statespace .gBase (1,1) Base model (cannot be separated into SISO elements) .sISO (:) .g (:) Controller statespace representation .type {:} Controller type .parameters {:} Controller parameters .connection (1,1) 'base input', 'base output', 'parallel' .baseInput (1,1) Base input if in series into a base input .baseOutput (1,1) Base output if in series from a base output .outputName (1,:) Output name .inputName (1,:) Input name
Typing ControlDesignGUI is the same as ControlDesignGUI( 'initialize' )
x = ControlDesignGUI( action, modifier, u )
action (1,:) Action 'initialize', 'update' modifier (1,:) Logo tiff if action is 'initialize' or GUI tag if not. u (:) Input when 'set data' is the action
x (:) Output is dependent on the action. On initialization returns the window tag.
function ConvertFortranFormatToC | ( | in | f | ) |
function ConvertOBJFileColorToMatlab | ( | in | m | ) |
Converts the Wavefront OBJ color format to MATLAB.
Edge color is set equal to face color
d = ConvertOBJFileColorToMatlab( m )
m (.) Material file data structure .Kd (1,3) Diffuse reflectivity .Ks (1,3) Specular reflectivity .Ka (1,3) Ambient reflectivity .Ns (1,3) Specular exponent .illum (1,3) Illumination model (not used) .d (1,1) Transparency
d (.) Matlab color .faceColor (1,3) Color of faces .edgeColor (1,3) Color of edges .diffuseStrength (1,1) .specularStrength (1,1) .ambientStrength (1,1) .specularExponent (1,1) .specularColorReflectance (1,1) .faceAlpha (1,1) Alpha channel
function CoordinateFrameFromUV | ( | in | u | ) |
function Coordinates | ( | in | m | ) |
function CPGas | ( | in | t, |
in | gas | ||
) |
function CPIAdjust | ( | in | cC, |
in | yearC, | ||
in | yearN | ||
) |
function CreateHTMLTable | ( | in | x, |
in | fileName, | ||
in | fString, | ||
in | title | ||
) |
Creates an HTML table from x.
x may be a two dimensional cell array or a matrix. If fileName is a string, it will open a file with the name fileName.html and write the matrix into the file. If instead you enter a file id it will write to the already open file. fString applies only to numbers. The default for fString is %12.4e.
CreateHTMLTable( x, fileName, fString, title ) or CreateHTMLTable( x, fId, fString, title )
x {:,:} or (:,:) Cell array or matrix fileName or fId (:) File name or file id fString (1,:) Number format string title (1,:) Table title
None
function CreateLatexTable | ( | in | x, |
in | fileName, | ||
in | fString, | ||
in | title | ||
) |
Creates a LaTeX table from x.
x may be a two dimensional cell array or a matrix. If fileName is a string, it will open a file with the name fileName.tex and write the matrix into the file. If instead you enter a file id it will write to the already open file. fString applies only to numbers. The default for fString is %12.4e.
CreateLatexTable( x, fileName, fString, title ) CreateLatexTable( x, fId, fString, title )
x {:,:} or (:,:) Cell array or matrix fileName or fId (:) File name or file id fString (1,:) Number format string title (1,:) Table title
None
function CreateTable | ( | in | x, |
in | fileName, | ||
in | fString, | ||
in | sep | ||
) |
Creates a table from x for displaying to the command line.
x may be a two dimensional cell array or a matrix. Based on CreateLatexTable and CreateHTMLTable but without the tags.
Forms: CreateTable( x ) CreateTable( x, fileName, fString ) CreateTable( x, fId, fString, sep )
function CToD | ( | in | g, |
in | dT, | ||
in | sType | ||
) |
function CWPAModel | ( | in | dT | ) |
Continuous Wiener process acceleration (CWPA) model.
This is a 2 dimensional model planar movement model that includes acceleration states.
This is a discrete time model.
The state is [x y xDot yDot xDoubleDot yDoubleDot]'.
Type CWPAModel for an example with dT = 1.
[a, h, q] = CWPAModel( dT )
dT (1,1) Time step (sec)
a (6,6) State transition matrix h (2,6) Measurement matrix q (6,6) Plant noise covariance matrix
function CylinderWithHemisphere | ( | in | r, |
in | h | ||
) |
function Database | ( | in | q, |
in | gUICode | ||
) |
GUI to output the value of a constant.
q must be an exact match.
Case and spaces have no effect. To search for a string (without using the GUI) type Database( searchString, 'find' ). You must initialize the database before using it. The first time you call Database type:
Database( 'fullFileName' )
or
Database
The second option will bring up a file selection dialog box. The database expects a tab separated text file of the form:
name value units reference
For a demonstration type
Database('Sample.db')
Once you open a database you cannot open another one with the command
Database(fileName)
since after opening all inputs are assumed to be database searches. Use clear to reset the function for a new database.
This function works the same as Constant.
[x, u] = Database( q, gUICode )
q (1,:) String describing the constant gUICode (1,:) GUI code
x (1,1) The value u (1,:) Units (if applicable)
function Date2DN | ( | in | datetime | ) |
Compute the day number from the date.
Uses the format from clock.
If no inputs are given it will compute the day number for the instant of the function call.
dn = Date2DN( datetime )
datetime (1,6) [year month day hour minute seconds]
dn (1,1) Day number
References: Montenbruck, O., T.Pfleger, Astronomy on the Personal Computer, Springer-Verlag, Berlin, 1991, p. 12.
function Date2FY | ( | in | datetime | ) |
function Date2JD | ( | in | datetime | ) |
Compute the Julian Date from the date.
Uses the format from clock. If no inputs are given, it will compute the Julian date for the instant of the function call. Only works for dates after 1600. You may omit the last three numbers (hour minute seconds) in the array. The date is in Greenwich Mean Time
jd = Date2JD( datetime )
datetime (1,6) [year month day hour minute seconds] or the datetime data structure. .year .month .day .hour .minute .second
jd (1,1) Julian date
References: Montenbruck, O., T. Pfleger, Astronomy on the Personal Computer, Springer-Verlag, Berlin, 1991, p. 12.
function DateChanged | ( | in | date, |
in | directory | ||
) |
function DateStringToJD | ( | in | s | ) |
function DBalReal | ( | in | a, |
in | b, | ||
in | c, | ||
in | d | ||
) |
Compute a balanced realization for discrete time systems.
Compute the balanced realization of a, b, c, d for discrete time systems.
[a, b, c, d, t, g, err] = DBalReal( a, b, c, d )
a State matrix b Input matrix c Output matrix d Feedthrough matrix
a State matrix b Input matrix c Output matrix d Feedthrough matrix t Transformation matrix g The observability and controllability grammiam err Error
function DBode | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | iy, | ||
in | iu, | ||
in | w, | ||
in | dT | ||
) |
Generates a Bode plot for a discrete time system.
Generates a Bode plot for a discrete time system from iu to iy. x(k+1) = ax(k) + bu(k) y(k) = cx(k) + du(k)
DBode( a, b, c, d, iy, iu, w, dT )
a (n,n State transition matrix b (n,m) Input matrix c (p,n) Measurement matrix d (p,m) Input feedthrough matrix iy (1,1) Output channel iu (1,1) Input channel w (1,:) Plot frequency vector (rad/sec) dT (1,1) Time step
none
function DCGain | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | sType | ||
) |
function DCGram | ( | in | a, |
in | b | ||
) |
function DeBlankAll | ( | in | s | ) |
function DeBlankLT | ( | in | s | ) |
function DebugLog | ( | in | msg, |
in | fullPath | ||
) |
function Deg2DMS | ( | in | a | ) |
function Deg2HMS | ( | in | a | ) |
function Delay | ( | in | T, |
in | n | ||
) |
Create a model of a delay using Pade approximants for exp(-sT).
[a,b,c,d] = Delay( T, n ) [num,den] = Delay( T, n )
T (1,1) Delay n (1,1) Number of terms
a or num Numerator polynomial or plant matrix b or den Denominator polynomial or input matrix c Measurement matrix d Feedthrough matrix
function DeleteCell | ( | in | c, |
in | k | ||
) |
function DeleteFromList | ( | in | h | ) |
function DeleteIfHandle | ( | in | h | ) |
function DeleteSuffix | ( | in | x | ) |
function DeltaQToRate | ( | in | q1, |
in | q2, | ||
in | dT | ||
) |
Angular rate from small quaternion changes.
This assumes small dT and small changes in q.
Type DeltaQToRate for a test with a random quaternion.
omega = DeltaQToRate( q1, q2, dT )
q1 (4,1) Old quaternion q2 (4,1) New quaternion dT (1,1) Time step (s)
omega (3,1) Angular rate (rad/s)
function DeltaT | ( | in | jd | ) |
Computes the difference between UT1 and TT based on the Julian date.
This model is based on observations up through 1993 and after that is a linear extrapolation. The equation is UT1 = TT - DT.
If you type DeltaT it will compute dt for the current date and time.
dt = DeltaT( jd )
jd (1,1) Julian date
dt (1,1) Time difference
References: U.S. Naval Observatory, MICA, U.S. Naval Observatory Washington, D.C., p. C-1.
function DigitalFilter | ( | in | uNew, |
in | nN, | ||
in | dN, | ||
in | xN, | ||
in | uN | ||
) |
Implement a digital filter.
Type DigitalFilter for a demo.
[xNew, xN, uN] = DigitalFilter( uNew, nN, dN, xN, uN )
uNew New input nN (1,n) Numerator polynomial dN (1,n) Denominator polynomial uN (1,n) Input storage xN (1,n) Output storage
xNew New output uN (1,n) Input storage xN (1,n) Output storage
function DirToCell | ( | in | path, |
in | y | ||
) |
function Disk | ( | in | r, |
in | n, | ||
in | z | ||
) |
function DiskWithHole | ( | in | rI, |
in | rO, | ||
in | n, | ||
in | z | ||
) |
function DispG | ( | in | action, |
in | modifier | ||
) |
function DisplayLatexTable | ( | in | s | ) |
function DispWithTitle | ( | in | x, |
in | t | ||
) |
Display a variable with a title.
x can be any MATLAB variable. If the title is left out, the variable name will be displayed via inputname. The variable is displayed using disp.
Type DispWithTitle for a demo.
Forms: DispWithTitle( x, t ) DispWithTitle( x )
x : Variable t (1,:) Title
None
function DistanceLabel | ( | in | d | ) |
function DMS2Deg | ( | in | d, |
in | m, | ||
in | s | ||
) |
function DMS2Rad | ( | in | d, |
in | m, | ||
in | s | ||
) |
Convert degrees, minutes and seconds to radians.
Inputs can be d,m,s, [d;m;s] or d:m:s or d:m or d.
Type DMS2Rad for a demo
rad = DMS2Rad( d, m, s ) rad = DMS2Rad( [d;m;s] ) rad = DMS2Rad( d );
d (1,:) Degrees or [d;m;s] or string m (1,:) Minutes s (1,:) Seconds
rad (1,:) Angle in radians
function DN2Date | ( | in | dN, |
in | year | ||
) |
Computes the date from the day number and year.
January 1 is day 1.
dateTime = DN2Date( dN, year )
dN (1,1) Day number year (1,1) Year
dateTime (1,6) [year month day hour minute seconds]
References: Montenbruck, O., T.Pfleger, Astronomy on the Personal Computer, Springer-Verlag, Berlin, 1991, p. 12.
function DN2JD | ( | in | dN, |
in | year | ||
) |
Computes the Julian Date from the day number and year.
January 1 is day 1. If no arguments are given it returns the current Julian date.
jD = DN2JD( dN, year )
dN (1,1) Day number year (1,1) Year
jD (1,1) Julian date
References: Montenbruck, O., T.Pfleger, Astronomy on the Personal Computer, Springer-Verlag, Berlin, 1991, p. 12.
function DNString2Date | ( | in | s | ) |
function DOGram | ( | in | a, |
in | c | ||
) |
function DoubleIntegratorRHS | ( | in | x, |
in | ignoredArg, | ||
in | u, | ||
in | mass | ||
) |
function DQ2Mat | ( | in | q, |
in | qDot | ||
) |
function DQCE | ( | in | phi, |
in | gamma, | ||
in | h, | ||
in | rw, | ||
in | rv | ||
) |
Create an optimal estimator.
Create an optimal estimator given a discrete time model of the form x[k+1] = phi x[k] + gamma w The estimator will be of the form xE = phi*xE + gamma*u + k*(y-h*xE)
k = DQCE( phi, gamma, h, rw, rv )
phi State transition matrix gamma Input matrix for plant noise h Measurement matrix rw Process noise rv Measurement noise
k Optimal gain
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, p. 452.
function DQCR | ( | in | a, |
in | b, | ||
in | q, | ||
in | r, | ||
in | n | ||
) |
Create a quadratic regulator.
Create a quadratic regulator of the form u = -Kx minimizing the cost functional J = †(1/2){u'ru + x'qx + u'nx + x'nu}dt. Given the constraint: x(k+1) = a x(k) + b u(k)
k = DQCR( a, b, q, r, n )
a Discrete time Plant matrix b Discrete time Input matrix q State cost matrix r Input cost matrix n State/input cost cross-coupling matrix
k Optimal gain
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, pp. 435-438.
function DrawCAD | ( | in | g, |
in | drawNormals, | ||
in | scale | ||
) |
Draw a CAD model stored in the toolbox CAD format.
Can be loaded from LoadCAD or made from BuildCADModel. This function draws the components only without applying any body rotations. Phong lighting is used. Black is used for all edges.
Type DrawCAD for a demo loading a dxf file.
h = DrawCAD( g, drawNormals, scale )
g (.) CAD model data structure drawNormals (1) Draw normals for all outside components scale (1,1) Scale factor for the quiver arrows (default 1)
h (1,:) Handles to patch objects
See also LoadCAD, patch
function DrawFOV | ( | in | f, |
in | l, | ||
in | axesHandle | ||
) |
Draw fields of view.
Type DrawFOV for a demo which draws two fields of view.
DrawFOV( f, l, axesHandle )
f (:) FOV data structure .r (3,1) Location .b (3,1) Unit boresight vector .fOV (1,1) Angle (rad) l (1,1) Length axesHandle (1,1) Handle of axes to draw on, or else makes new figure.
None
function DrawImage | ( | in | hParent, |
in | position, | ||
in | file, | ||
in | path, | ||
in | width | ||
) |
Draws an image in a figure window.
If file is empty you will be asked to select a file via uigetfile.
i = DrawImage( hParent, position, file, path, width )
hParent (1,1) Handle to the figure position (1,2) [x,y] lower left corner (pixels) file (1,:) File name path (1,:) Path name width (1,1) Width
i (:,:,:) Image
See also uigetfile, imread, image
function DrawSphere | ( | in | R, |
in | surfCol, | ||
in | lineCol, | ||
in | latMarks, | ||
in | longMarks | ||
) |
Draw a sphere with specified latitude and longitude lines.
Type DrawSphere for a demo.
[fig, s] = DrawSphere( R, surfCol, lineCol, latMarks, longMarks )
R (1,1) Radius surfCol (1,:) Surface color (character of 1 by 3 array) lineCol (1,:) Line color (character of 1 by 3 array) latMarks (1,:) Latitude mark angles lonMarks (1,:) Longitude mark angles
fig (1,1) Figure handle s (1,1) Surface handle
function DrawTreeDiagram | ( | in | hFig, |
in | tree, | ||
in | position, | ||
in | buttonDownFunction | ||
) |
Creates and draws a tree diagram.
[q, sIndex] = DrawTreeDiagram( hFig, tree, position, buttonDownFunction )
hFig (1,:) Figure handle tree {} Tree cell array position (1,4) [x y width height] buttonDownFunction (1,:) String of the form function( xxxxx, The tree block id is substituded after xxxxx, to get function( xxxxx, 1 )
q (1,1) Data structure with the graphical display tree data sIndex {} index into graphical tree
function DrawVertices | ( | in | v, |
in | f, | ||
in | name, | ||
in | blend | ||
) |
function DRiccati | ( | in | g | ) |
Solves the discrete matrix Riccati equation.
Solves the matrix Riccati equation in the form g = [a r] [q -a'] Since version 2.
[sinf, rr] = DRiccati( g )
g Input matrix
sinf Steady-state solution rr Repeated roots 1= repeated roots
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, pp. 435-438.
function DTAToDTS | ( | in | t | ) |
function DTSToDTA | ( | in | t | ) |
function DualListPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create dual lists.
Typing DualListPlugIn is the same as DualListPlugIn('initialize')
x = DualListPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifier (1,:) Modifier to the action hFig (1,1) Handle to the figure position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) Depends on the action.
function EditDlg | ( | in | string, |
in | defaultString, | ||
in | waitTime | ||
) |
function EditScroll | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position | ||
) |
Implement a scrollable edit window.
tag = EditScroll( 'initialize', text, hFig, [10 10 200 100] )
x = EditScroll( action, modifier, hFig, position )
action (1,:) Action to perform modifier (1,:) Modifier to the action hFig (1,1) Figure handle position (1,4) [left, bottom, width, height]
x (:,:) The text
function EigenstructurePlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create an Eigenstructure GUI plug in.
Typing EigenstructurePlugIn is the same as EigenstructurePlugIn('initialize');
x = EigenstructurePlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function EigEval | ( | in | g, |
in | hAxes | ||
) |
function EKFPredict | ( | in | d | ) |
Extended Kalman Filter prediction step.
d = EKFPredict( d )
d (1,1) EKF data structure .m (n,1) Mean .p (n,n) Covariance .q (n,n) State noise .f (1,:) Name of right hand side .fX (1,:) Jacobian of right hand side .fData (1,1) Data structure with data for f .dT (1,1) Time step .t (1,1) Time
d (1,1) EKF data structure
function EKFUpdate | ( | in | d | ) |
Extended Kalman Filter measurement update step.
All inputs are after the predict state (see EKFPredict). The h data field may contain either a function name for computing the estimated measurements or an m by n matrix. If h is a function name you must include hX which is a function to compute the m by n matrix is a linearized version of the function h.
d = EKFUpdate( d )
d (1,1) EKF data structure .m (n,1) Mean .p (n,n) Covariance .h (m,n) Either matrix or name of function .hX (1,:) Name of Jacobian for h .y (m,1) Measurement vector .r (m,m) Measurement covariance vector .hData (1,1) Datastructure for the h and hX functions
d (1,1) EKF data structure .m (n,1) Mean .p (n,n) Covariance .v (m,1) Residuals
function Ellipsd | ( | in | a, |
in | b, | ||
in | c, | ||
in | n | ||
) |
Generates an ellipsoid using the equation.
2 2 2 x y z
— + — + — = 1
2 2 2 a b c
Generates three n-by-n matrices so that surf(x,y,z) produces a unit sphere.
[x, y, z] = Ellipsd( a, b, c, n )
a x-axis coefficient b y-axis coefficient c z-axis coefficient n Number of facets
x (n,n) x matrix y (n,n) y matrix z (n,n) z matrix
function EmptyBlock | ( | ) |
Produce an empty data structure used by the control functions.
x .g (1,1) Complete block model of class statespace .gBase (1,1) Base model (cannot be separated into SISO elements) .blockInputs {:} Inputs to block .blockOutputs {:} Outputs from block .sISOID (1,1) ID of SISO element (not used here) .sISO (:) SISO parameters .g (1,1) Controller statespace class .name (1,:) Controller name .element {:} Controller type .parameters {:} Controller parameters .inputs {:} Inputs .outputs {:} Outputs .esa (:) Eigenstructure parameters .lq (:) Linear quadratic parameters
x = EmptyBlock
None
x (1,1) Data structure defined above
function EmptySISO | ( | ) |
Produce an empty data structure used by the control functions.
x (:) SISO parameters .g (1,1) Controller statespace representation .name (1,:) Controller name .element {:} Controller type .parameters {:} Controller parameters .inputs {:} Inputs .outputs {:} Outputs
x = EmptySISO
None
x (1,1) Data structure defined above
function Equal | ( | in | a, |
in | b | ||
) |
Returns one if a and b are identical.
This function calls itself recursively. a and b can be arrays, cell arrays or structures. Equal will be limited by the depth of recursion that you have set for Matlab.
k = Equal( a, b )
a (1,1) A variable b (1,1) A variable
k (1,1) = 1 if they are identical
function ESAssign | ( | in | g, |
in | lambda, | ||
in | vD, | ||
in | fC | ||
) |
Apply eigenvector and eigenvalue assignment.
Type ESAssign for a demo.
f = ESAssign( g, lambda, vD, fC )
g (:) State space system of type statespace lambda (n) Desired eigenvalues vD (:,n) Desired eigenvectors fC (3,p) Control constraint equation
f Gain matrix
Reference: Andry, A. N., Jr., Shapiro, E.Y. and J.C. Chung, "Eigenstructure Assignment for Linear Systems," IEEE Transactions on Aerospace and Electronic Systems, Vol. AES-19, No. 5. September 1983.
function ESAssignDraper | ( | in | g, |
in | lambda, | ||
in | vD, | ||
in | r, | ||
in | fC | ||
) |
Apply eigenvector assignment using the Draper method.
vD is entered with nan where you don't care about the value of the eigenvector. Type EAssignDraper for a demo.
f = ESAssignDraper( g, lambda, vD, r, fC )
g (:) State space system of type statespace lambda (n) Desired eigenvalues vD (:,n) Desired eigenvectors r (:,n) Weighting matrix fC (3,p) Control constraint equation
f Gain matrix
Reference: Orr H. A., "An Integrated Fire/Flight Control System for a Conventionally Configured A-10 Aircraft," CSDL-T-794, December 1982.
function Eul2Mat | ( | in | e | ) |
function Eul2Q | ( | in | e | ) |
function EulDot2Rates | ( | in | e, |
in | wEul, | ||
in | n | ||
) |
Converts 3-2-1 Euler angle rates into angular velocity.
If only one input is given, the output is the transformation matrix.
w = EulDot2Rates( e, wEul, n )
e (3) Euler angles wEul (3) Angular rates n (1) Orbit rate (for rotating frames only, optional)
w (3) Euler angle rates
Reference: Hughes, Spacecraft Attitude Dynamics (1986), Eq. 25 p. 27
function EVAssgnC | ( | in | g, |
in | lambda, | ||
in | vD, | ||
in | d, | ||
in | rD, | ||
in | w | ||
) |
Use eigenvector assignment to design a controller.
Complex lambdas must be in pairs. Their corresponding eigenvectors must also be complex. The design matrix, d. One column per state. Each row relates vD to the plant matrix. For example, rows 7 and 8 relate column 3 in vD to the plant. In this case vD(1,3) relates to state 2 and vD(2,4) relates to state 3. vD need not have as many columns as states. If the desired vD are eigenvectors then d is the identity matrix If the desired vectors are directions in the output then D = c If components of v are no concern the corresponding column of D should be zero. rD gives the rows in D per eigenvalue Each column is for one eigenvalue i.e. column one means that the first three rows of D relat to eigenvalue 1
[k, v] = EVAssgnC( g, lambda, vD, d, rD, w )
g (:) State space system of type statespace lambda (n) Desired eigenvalues vD (:,n) Desired eigenvectors d (:,n) Design matrix rD (n) Rows in d per eigenvalue w (:,n) Weighting vectors
k Gain matrix v Achieved eigenvectors
Reference: Stevens, B.L., Lewis, F.L. Aircraft Control and Simulation John Wiley & Sons, 1992, pp. 342-358. Andry, A. N., Jr., Shapiro, E.Y. and J.C. Chung, "Eigenstructure Assignment for Linear Systems," IEEE Transactions on Aerospace and Electronic Systems, Vol. AES-19, No. 5. September 1983.
function EVAssgnE | ( | in | g, |
in | lambda, | ||
in | vD, | ||
in | d, | ||
in | rD | ||
) |
Use eigevector assignment to design an estimator.
Complex lambdas must be in pairs. Their corresponding eigenvectors must also be complex. The design matrix, d. One column per state. Each row relates vD to the plant matrix. For example, rows 7 and 8 relate column 3 in vD to the plant. In this case vD(1,3) relates to state 2 and vD(2,4) relates to state 3. vD need not have as many columns as states. rD gives the rows in D per eigenvalue Each column is for one eigenvalue i.e. column one means that the first three rows of D relat to eigenvalue 1 When you create statespace it should be: g = statespace( a, [], c );
[k, v] = EVAssgnE( g, lambda, vD, d, rD )
g (:) Statespace system lambda (n) Desired eigenvalues vD (:,n) Desired eigenvectors d (:,n) Design matrix rD (n) Rows in d per eigenvalue
k Gain matrix v Achieved eigenvectors
function EVDesMat | ( | in | nStates, |
in | kAssign | ||
) |
function ExportToPSSMatrix | ( | in | fileName, |
in | varargin | ||
) |
Export two dimensional matrices to a file that can be read by pss_matrix.
You can then read from the file in C++ using:
#include <fstream.h>
#include <iostream.h>
ifstream matrixIn( fileName ); matrixIn >> matrix1; matrixIn >> matrix2; matrixIn.close();
ExportToPSSMatrix( fileName, matrix1, matrix2, ... )
fileName (1,:) File name matrix1 (:,:) First matrix matrix2 (:,:) Second matrix ... (:,:) Additional matrices
None
function Extrude | ( | in | z, |
in | c, | ||
in | topClosed, | ||
in | bottomClosed, | ||
in | cI | ||
) |
Generate an object from cross sections.
Type Extrude for a demo.
[v, f] = Extrude( z, c, topClosed, bottomClosed, cI )
z (1,n) z locations c (n) Crossection data .x (1,m) x locations .y (1,m) y locations topOpen 1 if top is closed bottomOpen 1 if bottom is closed cI (n) Interior crossection data .x (1,m) x locations .y (1,m) y locations
v (:,3) Vertices f (:,3) Faces
function ExtrudeFromProfile | ( | in | z, |
in | r, | ||
in | topClosed, | ||
in | bottomClosed, | ||
in | n, | ||
in | rI | ||
) |
Extrude from a radial profile.
Can have an inner and outer radius. Type ExtrudeFromProfile for a demo.
[v, f] = ExtrudeFromProfile( z, r, topClosed, bottomClosed, n, rI )
z (1,m) z locations r (m) Radii topOpen (1,1) 1 if top is closed, default is open bottomOpen (1,1) 1 if bottom is closed, default is open n (1,1) Number of circumferential divisions rI (m) Inner radii
v (:,3) Vertices f (:,3) Faces
See also: Extrude
function FFTEngy | ( | in | y, |
in | tSamp, | ||
in | aPeak, | ||
in | noLog | ||
) |
Plot the energy in a signal.
Will annotate peaks if y is a 1-dimensional array. y may be entered by column or row, but the longest dimension will be assumed to be the variation by time.
[e, w] = FFTEngy( y, tSamp, aPeak, noLog )
y (:,n) Sequence tSamp (1,1) Sampling period aPeak (1,1) Anotate peaks about this fraction of max noLog (1,1) If input will not use a log plot
e Energy w Frequencies (rad/sec)
function Figui | ( | in | h, |
in | fs, | ||
in | pos | ||
) |
function FileFullpath | ( | in | filename, |
in | overwrite | ||
) |
Save the file at the path of the calling function.
Use dbstack to find the absolute path of the calling function, and create a filename using the path.
Example:
fullname = FileFullpath( 'MyFile.txt', false ) fullname = '/Path/To/CallingFolder/MyFile_1.txt'
fullname = FileFullpath( filename, overwrite )
filename '' The string name of the file, with extension. If no extension is given it is assumed to be a mat-file. overwrite (1) Flag whether to overwrite the existing file - default is true - or to append the name of the file with a modifier should it already exist. Filenames will be appended with an underscore and a number starting with _0.
fullname '' Full qualified filename
function FindDirectory | ( | in | d, |
in | ignoredArg | ||
) |
Returns the path to a directory.
The default behavior is to return the first match. If a second argument is given the function will return all matches. d may be a partial path provided it is within the current directory.
p = FindDirectory( d, ~ )
d (1,:) Name of the directory ~ Any second input, returns all matches
p (1,:) Path to the files in the directory OR {:} Cell array of paths if 'all' option is specified
function Finder | ( | in | action, |
in | modifier | ||
) |
GUI to find occurrences of a text string in m-files on your MATLAB path.
Search the whole path or a selected directory. Choose case sensitivity and whether or not to include comments.
This GUI enables you to find usage of a function or variable, or to search for keywords across functions in your toolboxes.
x = Finder(action, modifier)
action (1,:) Action to be taken by the gui (used only for callbacks) modifier (1,:) Modifier to the action
x
function FindInFiles | ( | in | string, |
in | caseSensitive, | ||
in | wholeWord, | ||
in | includeComments, | ||
in | fileSet | ||
) |
Find all files that contain a specified string.
[files,lineNums,lines] = FindInFiles( string,caseSensitive,wholeWord, includeComments, fileSet );
string (:) Text string to search for. Note: If no string is provided, or if '' is provided, the function will return the entire searchable file set. (Optinal. Default is '') caseSensitive (1) Flag indicating whether the search should be case sensitive (Optional. Default is NOT case sensitive, 0) wholeWord (1) Flag indicating whether to search for only the whole word or not (Optional. Default is NOT to constrain search to whole word, 0) includeComments (1) Flag indicating whether to include comments in the search 0 - do NOT include comments in the search 1 - INCLUDE comments in the search (no restriction) 2 - allow ONLY comments to be included in the search Note: If a "%" symbol appears before the first instance of the string in a line, the line is considered a comment. (Optional. Default is to INCLUDE comments in the search, 1) fileSet {:} The searchable file/folder set. This is a cell array of file and/or folder names to search over. Either the full file/folder name (directory path prepended) or the partial name may be used. Whenever listing files, the file extension MUST be included. Note: If only a partial filename is provided, the file that appears FIRST in the Matlab search path will be used. (Optional. Default is to search over all m-files in the path)
files {N,1} Cell array list of all "N" files containing the string (subject to case sensitivity and comment inclusion constraints) lineNums {1,N}(1,M) Cell array of "N" vectors. Each vector is a list of line numbers where the string was found. Note: If no string is supplied, this output is just {} lines {1,N}{1,M} Cell array of "N" cells, each containing "M" lines of text. Each line of text is an entire line found in the corresponding file that contains the string. Note: If no string is supplied, this output is just {}
function FindPeaks | ( | in | x, |
in | y | ||
) |
function FindRequiredFiles | ( | in | FunctionIn, |
in | DirectoryIn, | ||
in | verbose | ||
) |
Find the files required by a function or a script in order to run.
i.e. the *.mat files All files located under the matlabroot directory are ignored, because they are assumed to be built-in MATLAB files. Since version 10.
[names,dirs] = FindRequiredFiles( FunctionIn, DirectoryIn, verbose )
FunctionIn {n} String or Cell array of function names DirectoryIn {n} String or Cell array of corresponding directory names verbose (1) Verbosity flag, defaults false
frequired {:} Cell array of required file names with extensions drequired {:} Cell array of corresponding directory names
function FindSolsticeOrEquinox | ( | in | type, |
in | year | ||
) |
Finds the Julian Date for solstices and equinoxes.
The default type is spring equinox and the default year is 2001. A four digit year must be entered (unless you are interested in years prior to 1000 AD.) You can enter strings as 'winter solstice 2002' See also FSolstice.
jD = FindSolsticeOrEquinox( type, year )
type (1,:) 'fall equinox', 'winter solstice' 'spring equinox', 'summer solstice' year (1,1) Year (Default is 2001)
jD (1,1) Julian Date
function FindStringInFiles | ( | in | z, |
in | d | ||
) |
function FirstLineOfCode | ( | in | filename | ) |
function FixLineEndings | ( | in | s | ) |
function fixpopupuicontrol | ( | in | fig | ) |
function flength | ( | in | f | ) |
function FNLSpring | ( | in | x, |
in | ignoredArg, | ||
in | fData | ||
) |
function FOPID | ( | in | e, |
in | d | ||
) |
Fractional order PID controller.
Implements a fractional order PID. The order can be from 0 to 1. 1 is a normal PID.
d.L gives the minimum and maximum terms to use. Below d.L(1), u will be zero.
Type FOPID to compare an order 1 PID with an order 0.5 PID and a traditional PID.
d = FOPID [u,d] = FOPID(e,d)
e (1,1) Input d (.) Data structure .lambda (1,1) The integral order (0 to 1) .mu (1,1) The derivative order (0 to 1) .L (1,2) Memory length [min max] .h (1,1) Time step ,kP (1,1) Proportional gain ,kI (1,1) Integral gain ,kD (1,1) Derivative gain .e (1,:) Memory of e
u (1,1) Output d (.) Data structure (see above) with d.e updated
Reference: Junhe Wan, Bo He, Dianrui Wang, Tianhong Yan and Yue Shen, "Fractional-Order PID Motion Control for AUV Using Cloud-Model-Based Quantum Genetic Algorithm," IEEE Access, https://ieeexplore.ieee.org/document/8817916/ references::references
function Fractal | ( | in | v, |
in | f, | ||
in | n, | ||
in | sigma | ||
) |
Generates fractals.
Pass a vertex list, face list, depth of the fractal generation and the standard deviation of the height increment. This routine requires that the face list contain only triangles. The algorithm adds new vertices at each midpoint displaced in the direction of the triangle normal a random amount determined by sigma. Each pass generates 7 triangles for each existing triangle.
Type Fractal for a demo.
v (:,3) Vertex list f (:,3) Face list n (1,1) Fractal depth sigma (1,1) Standard deviation of height change
v (:,3) Vertex list f (:,3) Face list
function FResp | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | iu, | ||
in | iy, | ||
in | w, | ||
in | uPhase, | ||
in | pType | ||
) |
Compute the frequency response of the system given a, b, c and d.
. x = ax + bu y = cx + du for the input vector iu, and output vector iy. If no output arguments are given it will automatically display Bode plots for all channels. If only 1 output is requested, the complex values will be output.
[mag, phase, w, io] = FResp( a, b, c, d, iu, iy, w, uPhase, pType ) [mag, phase, w, io] = FResp( num, den, w, uPhase, pType )
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix iu Inputs ( = 0, or leave out for all) iy Outputs ( = 0, or leave out for all) w (1,:) Frequency vector uPhase (1,:) Unwrap phase = 'wrap' to wrap it within 180 deg pType (1,:) 'bode' or 'nichols'
mag Magnitude vector phase Phase angle vector (deg) w (1,:) Frequencies computed io Input/output vector per plot [input,output;...]
References: Laub, A., "Efficient Multivariable Frequency Response Computations," IEEE Transactions on Automatic Control, Vol. AC-26, No. 2, April 1981, pp. 407-408. Maciejowski, J. M., Multivariable Feedback Design, Addison-Wesley, Reading, MA, 1989, pp. 368-370.
function FRespG | ( | in | f, |
in | iu, | ||
in | iy, | ||
in | w, | ||
in | uPhase, | ||
in | pType | ||
) |
Compute the frequency response given the statespace class as input.
. x = ax + bu y = cx + du for the input vector iu, and output vector iy. If no output arguments are given it will automatically display Bode plots for all channels. If only 1 output is requested, the complex values will be output.
[mag, phase, w, io] = FRespG( f, iu, iy, w, uPhase, pType )
f State space system of type statespace iu Inputs ( = 0, or leave out for all) iy Outputs ( = 0, or leave out for all) w Frequency vector uPhase Unwrap phase = 'wrap' to wrap it within 180 deg pType 'bode' or 'nichols'
mag Magnitude vector phase Phase angle vector (deg) w Frequencies computed io Input/output vector per plot [input,output;...]
References: Laub, A., "Efficient Multivariable Frequency Response Computations," IEEE Transactions on Automatic Control, Vol. AC-26, No. 2, April 1981, pp. 407-408. Maciejowski, J. M., Multivariable Feedback Design, Addison-Wesley, Reading, MA, 1989, pp. 368-370.
function FRespPlot | ( | in | mag, |
in | phase, | ||
in | w, | ||
in | pType, | ||
in | iu, | ||
in | iy | ||
) |
Plot the frequency response of the system in Bode or Nichols form.
FRespPlot( mag, phase, w, pType, iu, iy );
mag (1,:) Magnitude response phase (1,:) Phase response w (1,:) Frequency vector pType (:) 'bode' or 'nichols' iu Inputs ( = 0, or leave out for all) iy Outputs ( = 0, or leave out for all)
None
function Frustrum | ( | in | rL, |
in | r0, | ||
in | l, | ||
in | n, | ||
in | topOpen, | ||
in | bottomOpen, | ||
in | angleStart, | ||
in | angleEnd | ||
) |
Generate a frustrum of a cone.
Type Frustrum for a demo.
[v, f] = Frustrum( rL, r0, l, n, topOpen, bottomOpen, thetaStart, thetaEnd )
rL (1,1) Top radius (z = l) r0 (1,1) Bottom radius (z = 0) l (1,1) Length n (1,1) Number of divisions topOpen (1,1) 1 if top is open bottomOpen (1,1) 1 if bottom is open angleStart (1,1) Start angle (default 0) angleEnd (1,1) End angle (default 2*pi)
v (:,3) Vertices f (:,3) Faces
function FSWClock | ( | in | action, |
in | d | ||
) |
function FunNames | ( | in | path | ) |
function FXNLSpring | ( | in | x, |
in | ignoredArg, | ||
in | d | ||
) |
function GasProperties | ( | in | gas | ) |
function Gen2nd | ( | in | zz, |
in | wz, | ||
in | zp, | ||
in | wp, | ||
in | tSamp, | ||
in | sType | ||
) |
Creates a second order transfer function.
s^2/wz^2 + 2 zz s/wz + 1 K(s) = ------------------------ s^2/wp^2 + 2 zp s/wp + 1
[a, b, c, d] = Gen2nd( zz, wz, zp, wp, tSamp, sType )
zz Damping ratio of the zero pair wz Undamped natural frequency of the zero pair zp Damping ratio of the pole pair wp Undamped natural frequency of the pole pair tSamp Sampling frequency sType State equation type ('Delta' or 'Z')
a Plant matrix b Input matrix c Measurement matrix d Feedthrough matrix
References: Wie, B., K. Byun, "New Generalized Structural Filtering Concept for Active Vibration Control Synthesis," J. Guidance and Control, Vol. 12, No. 2, March-April 1989, pp. 147-154.
function GeomPatch | ( | in | d, |
in | cData, | ||
in | cMap | ||
) |
Get vertices for surfaces of revolution, ellipsoids and cylinders.
All surfaces, except for ellipsoids, are closed. Type GeomPatch for a demo.
[v, f, c] = GeomPatch( d, cData, cMap )
d (.) Data structure Surface of revolution: d.a, d.n, d.zUpper, d.zLower d.a r as a function of polynomial z a(1)*z^n + a(2)*z^(n-1)... a(n)*z^0] d.n Number of divisions d.zUpper Upper z limit d.zLower Lower z limit Cylinder: d.rU, d.rL, d.zUpper, d.zLower, d.n d.rU Upper radius d.rL Lower radius d.zUpper Upper z limit d.zLower Lower z limit d.endcap Any value creates endcaps Ellipsoid: d.a, d.b, d.c, d.thetaUpper, d.n d.a X radius d.b Y radius d.c Z radius d.thetaUpper Upper angle. Ranges from 0 to thetaUpper d.n Number of divisions The default value for n is 6. cData (m,p) Indexes to the color map where the values range from 1 to n cMap (n,3) Color Map
v (:,3) Vertices f (:,3) Faces c (:,3) Vertex color data where the number of rows equal the number of vertices
function GetCurrentGUIObject | ( | in | hFig | ) |
function GetEntry | ( | in | h, |
in | d, | ||
in | errMsg | ||
) |
Gets the input from a vector of graphics handles and determines.
if the input entries are valid.
[x, valid, e] = GetEntry( h, d, errMsg )
h (n) Vector of graphics handles d (1|n) Data structure of valid parameters Must enter either 1 or n data structures Field Default Description ----- ------- ----------- .type 'scalar' {'scalar','vector','matrix','string'} .empty 'no' 'yes' = empty entry is valid .integer 'no' 'yes' = only integers allowed .max inf maximum allowable value .min -inf minimum allowable value .maxElements 1 maximum number of elements for scalar/vector .minElements 1 minimum number of elements for scalar/vector .maxColumns inf maximum number of columns for matrix .minColumns 1 minimum number of columns for matrix .maxRows inf maximum number of rows for matrix .minRows 1 minimum number of rows for matrix .complex 'no' 'yes' = complex values allowed .maxImag inf maximum allowable imaginary value .minImag -inf minimum allowable imaginary value .maxComplexMag inf maximum allowable complex magnitude .minComplexMag -inf minimum allowable complex magnitude errMsg (1) 1 = show default error dialog boxes (default is 1)
x {n} Cell array containing field input. If a numerical value is desired and the entry is valid, the numerical value is returned in the cell array. Otherwise, the entered string is returned. If only one handle is entered and the entry is numeric, x is a scalar/vector/matrix, not a cell array. Vector output is a column vector. valid (n) 1 = valid e (n) Data structure with same fields as d indicating which error occured. 1 = error, [] = no error.
function GetFileRoot | ( | in | s | ) |
function GetFileSuffix | ( | in | s | ) |
function GetHeaders | ( | in | p | ) |
function GetInputFromString | ( | in | s | ) |
Generates an output from a string.
s may be a matrix, a workspace variable, a function with or without arguments or a .mat file. e.g. s = [1;2;2]; s = QZero s = QForm( q, v ) s = a where a, q and v are workspace variables Type GetInputFromString for a demo.
[x, err] = GetInputFromString( s )
s (1,:) String
x : Value err (1,:) Error message
function GetListString | ( | in | h | ) |
function GetModificationDate | ( | in | fileName, |
in | p | ||
) |
function GetNewTag | ( | in | name | ) |
function GetUIElement | ( | in | h, |
in | property | ||
) |
function GND | ( | in | num, |
in | den, | ||
in | w | ||
) |
Compute the frequency response given a numerator/denominator pair.
y(s) = num(s)*u(s)/den(s) G(s) = num(s)/den(s) This is a multi-output, single-input system Each column will give the value for G(s) for that frequency.
[g,nu,w] = GND(num,den,w)
num Transfer function numerator(s) den Transfer function denomenator(s) w Frequency vector
g Frequency response matrix nu Number of inputs w Frequency vector
References: Laub, A., "Efficient Multivariable Frequency Response Computations," IEEE Transactions on Automatic Control, Vol. AC-26, No. 2, April 1981, pp. 407-408. Maciejowski, J. M., Multivariable Feedback Design, Addison-Wesley, Reading, MA, 1989, pp. 368-370.
function GPMargin | ( | in | m, |
in | p, | ||
in | w | ||
) |
Computes gain and phase margins from magnitude and phase.
[gM, wG, pM, wP] = GPMargin( m, p, w ) [gM, wG, pM, wP] = GPMargin( g, w )
m Gain (db) or complex transfer function p Phase (deg) w Frequency vector
gM Gain margin (dB) wG Frequencies of gain crossovers (rad/sec) pM Phase margins (deg) wP Frequencies of phase crossovers (rad/sec)
function GPoly | ( | ) |
function GSS | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | iu, | ||
in | iy, | ||
in | w | ||
) |
Compute the multivariable frequency response of the system.
. x = ax + bu y = cx + du or G(s) = c*inv(sI-a)*b + d y(s) = G(s)*u(s) For example, for 3 outputs and 2 inputs g is of the form w(1) w(2) ... output 1 [ input 1 input 2 | input 1 input 2 |... ] output 2 [ input 1 input 2 | input 1 input 2 |... ] output 3 [ input 1 input 2 | input 1 input 2 |... ]
[g,nu,w] = GSS(a,b,c,d,iu,iy,w)
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix iu Inputs ( = 0, or leave out for all) iy Outputs ( = 0, or leave out for all) w Frequency vector
g Frequency response matrix nu Number of inputs w Frequency vector
References: Laub, A., "Efficient Multivariable Frequency Response Computations," IEEE Transactions on Automatic Control, Vol. AC-26, No. 2, April 1981, pp. 407-408. Maciejowski, J. M., Multivariable Feedback Design, Addison-Wesley, Reading, MA, 1989, pp. 368-370.
function GUIColors | ( | in | action, |
in | modifier | ||
) |
function HasOptimizationToolbox | ( | ) |
function HierarchicalListPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback, | ||
in | params | ||
) |
Create and manages a hierarchical list.
Each element of the list is
h(k).name = 'mike'; h(k).parent = ''; h(k).child = {'pete'}; h(k).data = ...; Data can be anything. Initialize
tag = HierarchicalListPlugIn( 'initialize', h, figureHandle, position, callback ) API
HierarchicalListPlugIn( 'add', tag, h ) % Parent can be empty HierarchicalListPlugIn( 'delete', tag ) HierarchicalListPlugIn( 'show', tag ) HierarchicalListPlugIn( 'hide', tag ) HierarchicalListPlugIn( 'set', tag, d ) d = HierarchicalListPlugIn( 'get', tag ) % Gets the entire list Get the name of the selected element s = HierarchicalListPlugIn( 'get selection', tag ) s = HierarchicalListPlugIn( 'get data for selection', tag ) s = HierarchicalListPlugIn( 'get list', tag )
x = HierarchicalListPlugIn( action, modifier, hFig, position, callback, params )
action (1,:) Action 'initialize', 'update' modifier (1,:) Modifier to the action hFig (1,1) Handle to the figure position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui params {:} Parameter pairs for the list uicontrol
x (1,1) Depends on the action.
function HMS2Deg | ( | in | h, |
in | m, | ||
in | s | ||
) |
function HMS2Rad | ( | in | h, |
in | m, | ||
in | s | ||
) |
function HNLSpring | ( | in | x, |
in | ignoredArg, | ||
in | hData, | ||
in | ignoredArg | ||
) |
function HoopStress | ( | in | r, |
in | p, | ||
in | sigma, | ||
in | type | ||
) |
Computes the thickness of a pressure vessel.
The default type is 'cylinder'. If there are no outputs it creates a plot.
Type HoopStress for a demonstration of a 0.2 m radius pressure vessel with a titanium shell.
t = HoopStress( r, p, sigma, type )
r (1,1) Radius (m) p (1,:) Pressure (N/m^2) sigma (1,1) Stress (N/m^2) type (1,:) 'cylinder' or 'sphere'
t (1,:) Thickness (m)
Reference: http://www.efunda.com/formulae/solid_mechanics/ mat_mechanics/pressure_vessel.cfm
function IC | ( | in | g, |
in | x, | ||
in | dT, | ||
in | nSim | ||
) |
function IC623X3 | ( | in | x | ) |
function IConv | ( | in | IVec | ) |
function IConvP | ( | in | IMat | ) |
function Icosahedron | ( | ) |
function IEKFUpdate | ( | in | d | ) |
Iterated Extended Kalman Filter measurement update step.
All inputs are after the predict state (see KFPredict).
d = IEKFUpdate( d )
d (1,1) EKF data structure .m (:,1) Mean .p (:,:) Covariance .h (:,n) Either matrix or name of function .hX (1,:) Name of Jacobian for h .nIts (1,1) Number of iterations
d (1,1) EKF data structure .m (:,1) Mean .p (:,:) Covariance .v (m,1) Residuals
function ImageOverlay | ( | in | x, |
in | wData, | ||
in | tBoxes | ||
) |
This function displays an image file and overlays text boxes.
The image file is in a .mat file. To generate the image:
xPict = imread('filename'); save imageName xPict ImageOverlay('imageName',wData)
ImageOverlay( x, wData, tBoxes )
x Image file on initialization or text data wData Window name .name string .color [r g b] tBoxes Box positions
none
function IMMPredict | ( | in | d | ) |
Interactive Multiple Models prediction step.
This does the interaction and filter steps. The inputs and outputs only show data structure fields used in this function. This assumes that the number and definitions of the state do not change. There are n models and m states. IMMUpdate is normally called after IMMPredict.
A complete IMM implementation is:
IMMPredict( d ) IMMUpdate( d )
d = IMMPredict( d )
d (.) IMM data structure .use (1,1) 'KF' 'EKF' 'UKF' Only KF is implemented .pIJ (n,n) Model transition probability .muI (1,n) Probability of being in that model .mI (m,n) Means for each model .pI {n} Covariance matrix for each model .aI {n} State transition matrix for each model .qI {n} Plant noise matrix for each model
d (.) IMM data structure .cHatJ (1,n) Scaling factor .mPI (m,n) Mean vectors for each model .pPI {n} Covariance matrix for each model
function IMMUpdate | ( | in | d | ) |
Interactive Multiple Models update step.
The inputs and outputs only show data structure fields used in this function.
All inputs are after the prediction of the state (see IMMPredict). IMMUpdate is called after IMMPredict. A complete IMM implementation is
IMMPredict( d ) IMMUpdate( d )
d = IMMUpdate( d )
d (1,1) IMM data structure .use (1,1) 'KF' 'EKF' 'UKF' Only KF is implemented .cHatJ (1,n) Scaling factor .mPI (m,n) Mean vectors for each model .pPI {n} Covariance matrix for each model .y (p,1) Measurements .h (p,m) Measurement matrix .r (p,p) Measurement noise covariance
d (1,1) IMM data structure .m (n,1) Aggregate mean .p (n,n) Aggregate covariance .mI (m,1) Model mean .pI {n}(m,m) Model covariance
function InertiaFromOBJFile | ( | in | fileName, |
in | mass, | ||
in | scale, | ||
in | c | ||
) |
Computes an inertia matrix from an obj file or data structure.
The data structure is g.component(k).v.
Assigns a mass proportional to the patch area and the centroid.
Type InertiaFromOBJFile for a demo of an X-15.
inr = InertiaFromOBJFile( fileName, mass, scale, c )
fileName (1,:) File name or data structure mass (1,1) Dry mass (kg) scale (1,1) Optional scale factor c (3,1) Optional center of mass (m)
inr (3,3) Inertia matrix (kg-m^2) c (3,1) Center of mass (m) area (1,1) Surface area (m^2)
function Inertias | ( | in | m, |
in | x, | ||
in | type, | ||
in | ignoredArg | ||
) |
Computes inertias of common objects about their c.m.
All objects have their axis of symmetry about z. If you enter a thickness with 'cylinder', 'box' or 'sphere' it will automatically compute the hollow versions.
The output is in the form:
[ixx iyy izz ixy ixz iyz]
If four arguments are entered it outputs a 3 by 3 matrix.
inr = Inertias( m, x, type, matType )
m (1,1) Mass x Relevant dimensions type Type of solid 'sphere' x = [radius] 'box' x = [xLength, yLength, zLength] 'plate' x = [xLength, yLength] 'disk' x = [radius] 'cylinder' x = [radius, zLength] 'ellipsoid' x = [a b c] 'hollow cylinder' x = [outer radius, zLength, thickness] 'hollow box' x = [xLength, yLength, zLength, thickness] 'hollow sphere' x = [radius, thickness] matType (1,1) Any argument causes the routine to return a 3x3 matrix
inr (1,6) Inertia matrix
function Inflation | ( | in | from, |
in | to | ||
) |
function InformDlg | ( | in | text, |
in | title | ||
) |
Create an information dialog that will be dismissed by a script.
Similar to msgbox but without a button. The text will be wrapped. The HandleVisibility of this figure is 'callback'. Use 'close all hidden' to delete figure in the case of errors.
Type InformDlg for a demo.
[figureHandle,msgHandle] = InformDlg( text, title )
text (:) Text of the message. title (:) Title of the message box.
figureHandle (1,1) Handle of figure. msgHandle (1,1) Handle to message string control.
function Integral | ( | in | Kdc, |
in | w, | ||
in | phase, | ||
in | tSamp, | ||
in | sType | ||
) |
Creates a general integrator.
Creates a general integrator of the form tau s + 1 K(s) = ---------- s + sigma Given the desired maximum phase magnitude (±90°) and frequency Type Integral for a demo.
[a, b, c, d] = Integral( Kdc, w, phase, tSamp, sType )
Kdc DC gain (db) w Frequency for phase (rad/sec) phase Phase angle (-90° to 0°) (deg) tSamp Sampling period sType State equation type ('Delta' or 'Z')
a Plant matrix b Input matrix c Measurement matrix d Feedthrough matrix
function IntersectPlaneAndSphere | ( | in | r, |
in | plane, | ||
in | n | ||
) |
Finds the vector giving the intersection.
of a plane and a sphere.
The normal is
n = ai + bj + ck
The equation of the plane is
a(x-x1) + b(y - y1) + c(z - z1) = 0
where [x1;y1;z1] is a point in the plane.
For example, the xy-plane is
z = 0 which is generated by a = 0, b = 0, c = 1 and [x1;y1;z1] = [dont care;dont care;0].
If no input arguments are entered it will generate a random plane. If no output arguments are specified it will plot the intersection.
v = IntersectPlaneAndSphere( r, plane, n )
r (1,1) Radius of sphere plane (1,1) Data structure for plane .n (3,1) Normal .x (3,1) Point in the plane n (1,1) Half the number of points on the equation of the intersection ellipse. The default is 50.
v (:) Data structure .x (3,n) Coordinates of the intersection .intersect (1,1) 1 if the plane intersects the sphere
function IntToBinary | ( | in | i | ) |
function InvSys | ( | in | a, |
in | b, | ||
in | c, | ||
in | d | ||
) |
Computes the inverse system.
Computes the inverse system where y is the input and u the output.
[ai, bi, ci, di] = InvSys( a, b, c, d )
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix
ai Inverse plant matrix bi Inverse input matrix ci Inverse measurement matrix di Inverse input feedthrough matrix
References: Maciejowski, J. M., Multivariable Feedback Design, Addison-Wesley, Reading, MA, 1989, pp. 376-378.
Since version 1.
function IsFunction | ( | in | filename | ) |
function IsValidField | ( | in | m, |
in | s | ||
) |
function IsVersionAfter | ( | in | n | ) |
function IsVersionBefore | ( | in | n | ) |
function JD2000 | ( | ) |
function JD2Array | ( | in | jD0, |
in | t | ||
) |
Compute an array of Julian dates from an epoch.
Forms: jD = JD2Array( jD0, t )
Input
jD0 (1,1) Epoch Julian date t (1,:) Time array (sec)
Output
jD (1,:) Julian date array
function JD2Date | ( | in | jd, |
in | structOut | ||
) |
Compute the calendar date from the Julian date.
Uses the format from clock. If no inputs are given it will output the current date and time of the function call.
datetime = JD2Date( jd, structOut )
jd (1,1) Julian date structOut (1,1) If entered, output a structure
datetime (1,6) [year month day hour minute seconds]
References: Montenbruck, O., T.Pfleger, Astronomy on the Personal Computer, Springer-Verlag, Berlin, 1991, p. 13.
function JD2Day | ( | in | jD | ) |
function JD2DN | ( | in | jD | ) |
function JD2MJD | ( | in | jD | ) |
function JD2T | ( | in | jd | ) |
function JDToDateString | ( | in | jD, |
in | ignoredArg | ||
) |
Convert Julian Date to the form '04/20/2000 00:00:00'.
If calForm is entered you will get Apr 20, 2000
Typing JDToDateString returns the current date.
s = JDToDateString( jD, calForm)
jD (1,1) Julian Date calForm (1,1) 'mm/dd/yyyy hh:mm:ss'
s (1,:) String 'mm/dd/yyyy hh:mm:ss' or 'Jan dd, yyyy'
function JDToMidnight | ( | in | jD | ) |
function JLQOF | ( | in | k, |
in | g, | ||
in | w, | ||
in | x | ||
) |
function JLQTOF | ( | in | k, |
in | g, | ||
in | w, | ||
in | t | ||
) |
function JLQTWOF | ( | in | k, |
in | g, | ||
in | w, | ||
in | t, | ||
in | options | ||
) |
Output feedback design with a reference input.
dx/dt = ax + bu + gr y = cx + fr z = hx (Performance criteria) The performance index is J = † (t^k *x'*P*x + x'*Q*x) dt options(1) = 1 add control to t^k term else add to Q options(2) = 1 tracker problem else regulator problem
j = JLQTWOF( k, g, w, t, options )
k Gain g State space data structure w Weighting matrix t Tracking matrices data structure options (1,2) Algorithm options options(1) = 1 Multiply the control weighting by t^k options(1) = 0 Multiply the control weighting by 1 options(2) = 1 Tracker problem options(2) = 0 Regulator problem
j Scalar cost
function KalmanFilterCombine | ( | in | xB, |
in | pB, | ||
in | xF, | ||
in | pF | ||
) |
Combine forward and backward covariances and states.
[xS, pS] = KalmanFilterCombine( xB, pB, xF, pF )
xB (n,1) Backward state pB (n,n) Backward covariance xF (n,1) Forward state pF (n,n) Forward covariance
xS (n,1) Smoothed state pS (n,n) Smoothed covariance
References: R.G. Brown and P.Y.C. Hwang. Introduction to Random Signals and Applied Kalman Filtering, 2nd Edition. John Wiley and Sons, 1992.
function KFilter | ( | in | r, |
in | phi, | ||
in | q, | ||
in | h, | ||
in | x, | ||
in | z, | ||
in | p, | ||
in | gamma, | ||
in | u, | ||
in | s | ||
) |
Mechanizes one step of a Kalman Filter with a forgetting factor.
x[k+1] = phi*x[k] + gamma*u[k] y[k] = x[k] + k[k]*(z - h*x[k])
The forgetting factor scales the covariance factor in the covariance update. If it were zero the covariance update would be the state covariance matrix q.
p = s*phi*p*phi' + q;
The function automatically forces symmetry on p by averaging p and p'.
The function handles deterministic inputs as shown above. gamma is optional so it will also handle x[k+1] = phi*x[k] + u[k].
Note that the matrices are for a discrete time system.
[x, p, k, y, pY] = KFilter( r, phi, q, h, x, z, p, gamma, u, s )
r (m,m) Measurement Covariance phi (n,n) State transition matrix q (n,n) Process noise covariance h (m,n) Measurement matrix x (n) Previous value of the state z (m) Measurement vector p (n,n) Covariance of xold gamma (n,l) Input matrix u (n) Deterministic input s Forgetting factor 1 = don't, ƒ = 1 stage filter
Outputs
x (n) Updated state this is at time k+1 p (n,n) Covariance of x k (n,m) Kalman Gain matrix y (m,1) Output at time k pY (n,n) Covariance after the measurement update
function KFInitialize | ( | in | type, |
in | varargin | ||
) |
Initializes Kalman Filter data structures for the KF, UKF, EKF and IEKF.
Enter parameter pairs after the type.
If you return with only one input it will return the default data structure for the filter specified by type. Defaults are returned for any parameter you do not enter.
d = KFInitialize( type, varargin )
type (1,1) Type of filter 'ukf', 'kf', 'ekf', 'iekf' varargin {:} Parameter pairs
d (1,1) Data structure
function KFPredict | ( | in | varargin | ) |
Linear Kalman Filter prediction step.
This assumes a discrete model of the form:
x[k] = a[k-1]x[k-1] + b[k-1]u[k-1] + q y[k] = h[k]x[k] + r
b and u are optional.
If only one argument is entered it assumes it is a datastructure of the form d = struct('m',m,'p',','a',a,'q',q,'b',b,'u',u) or d = struct('m',m,'p',','a',a,'q',q,'bU',b*u)
[m, p] = KFPredict( d ) [m, p] = KFPredict( m, p, a, q, b*u ) [m, p] = KFPredict( m, p, a, q, b, u );
m (n,1) Mean p (n,n) Covariance matrix a (n,n) State transition matrix q (n,n) Model noise matrix b (n,p) Deterministic input matrix u (p,1) Deterministic input vector
m (n,1) Mean p (n,n) Covariance matrix
function KFUpdate | ( | in | varargin | ) |
Linear Kalman Filter measurement update step.
This assumes a discrete model of the form:
x[k] = a[k-1]x[k-1] + b[k-1]u[k-1] y[k] = h[k]x[k]
All inputs are after the predict state (see KFPredict). The Kalman filter can be initialized using KFInitialize. This routine can use the data structure form of the measurement where the measurement is in y.data.
The inputs can be individual matrices or as part of a data structure. The data structure is d = struct('m',m,'p',p,'y',y,'h',h,'r',r);
All Kalman Filter routines accept data structures.
Forms: d = KFUpdate( d ) [m,p,v,s,k] = KFUpdate( m, p, y, h, r )
m (n,1) Mean vector p (n,n) Covariance matrix y (m,1) Measurement vector h (m,n) Measurement matrix r (m,m) Measurement noise matrix
m (n,1) Mean vector p (n,n) Covariance matrix v (n,n) Residual vector s (n,n) Covariance denominator k (n,n) Kalman gain matrix
function KronProd | ( | in | a, |
in | b | ||
) |
function KronSum | ( | in | a, |
in | b | ||
) |
function KSmooth | ( | in | r, |
in | phi, | ||
in | q, | ||
in | h, | ||
in | z, | ||
in | pI | ||
) |
Mechanizes a Kalman Filter fixed interval smoother.
You input a full set of measurements and it outputs the smoothed results.
r (m,m) Measurement Covariance phi (n,n) State transition matrix q (n,n) Process noise covariance h (m,n) Measurement matrix z (m,:) Measurement vector p (n,n) Initial covariance
Outputs
xS (n,:) Filtered state pDiag (n,:) Covariance diagonal
function LabelLine | ( | in | x, |
in | t, | ||
in | n, | ||
in | f | ||
) |
function LabelS | ( | in | x, |
in | y, | ||
in | z, | ||
in | font | ||
) |
function LatexExp | ( | in | n, |
in | f | ||
) |
Creates a latex exponential string.
Converts a number like 1.2e3 in 1.2$\times 10^{3}$.
Type LatexExp for a demo.
See also LatexScientificNotation.
s = LatexExp( n, f )
n (1,1) Number f (1,:) Exponential format (don't include the e)
s (1,:) Latex string
Copyright (c) 2017 Princeton Satellite Systems, Inc. All rights reserved.
Since version 2018.1 2020.1 Added default for f
function LatexScientificNotation | ( | in | x, |
in | n, | ||
in | m | ||
) |
function LatexTableFromStructure | ( | in | s, |
in | f, | ||
in | u | ||
) |
Creates a LaTeX table from s.
It searches the data structure recursively so that each column is a field name. The final column has numbers. u has the same structural form as s but rather than numbers each value is a units array. For example s.a = 1; s.b.q = 2; s.b.r = 3; has a corresponding u u.a = 'rad'; u.b.q = 'N'; u.b.r = 'm'; Type LatexTableFromStructure for a demo.
x = LatexTableFromStructure( s, f, u )
s (1,1) Data structure f (1,:) File name u (1,1) Data structure of units
x {:,:} The cell array
function LeadLag | ( | in | wmax, |
in | phasemax, | ||
in | Kdc, | ||
in | tSamp, | ||
in | sType | ||
) |
Create a lead or lag.
Create a lead or lag with the appropriate phase characteristics in the form
tau1 s + 1 K(s) = Kdc ---------- tau2 s + 1 Given the desired maximum phase magnitude (±90°) and frequency
[a, b, c, d] = LeadLag( wmax, phasemax, Kdc, tSamp, sType )
wmax Frequency for max (rad/sec) phasemax Max phase angle (deg) Kdc DC gain (db) tSamp Sampling period sType State equation type ('Delta' or 'Z')
a Plant matrix b Input matrix c Measurement matrix d Feedthrough matrix
function LeapYear | ( | in | datetime | ) |
function LegendFig | ( | in | names, |
in | colors, | ||
in | figTitle | ||
) |
Produce a new figure with just a legend of colors and names.
h = LegendFig( names, colors, title )
names {1,n} Cell array of names to go in the legend colors {1,n} Cell array of 1-character colors -or- (n,3) n rows of 3-element color vectors figTitle (1,:) Title for new legend figure. Optional.
h (1,1) Figure handle. See also: ColorSpread.m
function LegendTitle | ( | in | name, |
in | size | ||
) |
function LegendWithTitle | ( | in | s, |
in | title, | ||
in | varargin | ||
) |
function LFBal | ( | in | g, |
in | gamma | ||
) |
Perform low frequency prebalancing of a system.
g = LFBal( g, gamma )
g (:) Plant model of type statespace gamma (1,1) Value of all singular values of g(0)
g (:) Augmented plant
Reference: Stevens, B.L., Lewis, F.L. Aircraft Control and Simulation John Wiley & Sons, 1992, pp. 466-469.
function Limit | ( | in | x, |
in | limit | ||
) |
function ListCases | ( | in | filename, |
in | beQuiet, | ||
in | first | ||
) |
List the switch cases that are included in a given file.
The default is to print the full set of case names to the command line as well as provide an output. To suppress the command line display pass true for quiet.
names = ListCases( filename, beQuiet, first )
filename (:) String name of file to examine beQuiet (1) Flag for quiet operation - no printout first (1) Flag to keep only first case for a cell array
names {:} Cell array of case names
function ListFunctions | ( | in | filename, |
in | level, | ||
in | noMatlabFuns, | ||
in | method | ||
) |
List the functions that are called from a given file.
All functions located under the matlabroot directory are ignored, because they are assumed to be built-in MATLAB functions.
If no filename is provided, the file "PIDMIMO" is used as an example.
[names,dirs,exts] = ListFunctions( filename, level, noMatlabFuns, method )
filname (:) String name of file to examine level (1) How many levels to search (-1 fully recursive, 1 for 'toponly') noMatlabFuns (1) Flag - exclude MATLAB functions (1) or not (0) method (1) Use "profile" or "depfun". Default is "depfun".
names {:} Cell array of function names dirs {:} Cell array of corresponding directory names exts {:} Cell array of extensions
function ListMemberFunctions | ( | in | filename, |
in | verbose | ||
) |
List the member functions that are included in a given function/file.
names = ListMemberFunctions( filename, verbose )
filname (:) String name of file to examine verbose (1) Print results (1) or not (0). Default is verbose.
names {:} Cell array of member function names lines {:} Cell array of member function definition lines
function ListParents | ( | in | fcn, |
in | folder, | ||
in | recursive | ||
) |
List all parents of a function.
Search inside given folder.
[parents,lineNums,lines] = ListParents( fcn, folder, recursive )
fcn (1,:) String name of file to examine folder (1,:) Folder name to search in. Can be a single name or cell array of names. Each name must have the full path included. recursive (1,1) Recursive flag. 1- search in all sub folders (default) 0- search only in given folder
parents {:} Cell array of parent function names lineNums {:} Cell array of line no.s in each parent function where child "fcn" is called. lines {:} Cell array of lines in each parent function where child "fcn" is called.
function LoadSimLog | ( | in | file | ) |
Reads data from a simulation log file.
If file is not entered it will display a file selection dialog box. Also see PlotDSimFile which handles component logs.
[x, v, r, s, t, d] = LoadSimLog( file )
file (1,:) File name
x (n,:) Data each row is a time step v {m} Names for each column. ":" replaced with "_" r {m} Indices in x for each variable. s {m} Native size for each variable t (1,n) MET of entries d (.) Data structure with Time and fields for all data using the names in v
Time,"-2 SC:rWARate","-2 SC:angularMomentum" 0.1,"[0.9999840718;2.000001976;3.000008952;3.999997113]","[1000.049761;-999.9602393;2000.079761]"
function Loc3D | ( | in | p, |
in | u, | ||
in | cM | ||
) |
function LocalTimeToGMT | ( | in | dateTime, |
in | lon | ||
) |
Compute the Julian Date from the local time.
This does not handle daylight savings time, etc.
jD = LocalTimeToJD( dateTime, lat, lon )
datetime (1,6) [year month day hour minute seconds] or the datetime data structure. .year .month .day .hour .minute .second lon (1,1) Longitude in radians
datetimeGMT (1,6) [year month day hour minute seconds] or the datetime data structure. .year .month .day .hour .minute .second jD (1,1) Julian date
function LocalTimeToJD | ( | in | dateTime, |
in | lon | ||
) |
Compute the Julian Date from the local time.
This does not account for daylight savings time.
jD = LocalTimeToJD( dateTime, lon )
datetime (1,6) [year month day hour minute seconds] or the datetime data structure. .year .month .day .hour .minute .second lon (1,1) Longitude in radians
jD (1,1) Julian date
function LogB | ( | in | b, |
in | x | ||
) |
function LogLimit | ( | in | wV | ) |
function LQC | ( | in | g, |
in | w, | ||
in | type, | ||
in | t | ||
) |
Design a quadratic controller.
[gC, j] = LQC( g, w, type, t )
g (:) Plant of type statespace w (:) Weighting matrices depends on the type of design ------------------------------- w.q : lq, lqe, lqg, all ...of, lqgltri w.r w.k (optional initial stabilizing gain for of) w.n (optional) ------------------------------- w.b : lqe ------------------------------- w.qE : lqg, lqgtro w.rE w.bE (optional) w.nE (optional) w.w (optional) Frequencies for sv plots ------------------------------- w.rho : lqgltri or lqgltro w.q0 w.gLow robustness low frequency limit w.gHigh robustness low frequency limit type (1,:) Type of design 'lq' Full state feedback 'lqe' Estimator 'lqg' Full state feedback with estimator 'lqof' Linear quadratic with output feedback 'lqtof' Linear quadratic tracker with output feedback 'lquwof' Time weighted control linear quadratic with output feedback 'lqtuwof' Time weighted control linear quadratic tracker with output feedback 'lqxwof' Time weighted state linear quadratic with output feedback 'lqtxwof' Time weighted state linear quadratic tracker with output feedback 'lqgltri' Full state feedback with estimator and loop transfer recovery at the input 'lqgltro' Full state feedback with estimator and loop transfer recovery at the output t (:) Tracking model .r .g .h
gC (:) Controller of type statespace j (:) .initial .final
function LQPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create an LQ plug in for the ControlDesignGUI.
Typing LQPlugIn is the same as LQPlugIn('initialize')
x = LQPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function MagPlot | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | iu, | ||
in | iy, | ||
in | w | ||
) |
Compute the magnitude frequency response of a system.s.
Compute the magnitude frequency response of the system x = ax + bu y = cx + du
for the input vector iu, and output vector iy. If no output arguments are given it will automatically display Bode plots for all channels.
[mag, io, w] = MagPlot( a, b, c, d, iu, iy, w ) [mag, io, w] = MagPlot( num, den, w )
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix iu Inputs ( = 0, or [] for all) iy Outputs ( = 0, or [] all) w Frequency vector
mag Magnitude vector io Input/output vector per plot [input,output;...] w Frequencies computed
function Map | ( | in | planet, |
in | mType, | ||
in | ignoredArg | ||
) |
Draws a 2 or 3 dimensional map of a planet.
Turns on mouse driven 3D rotation if mType == '3d'. String inputs are not case sensitive. planet is the name of a .mat file with the variables planetMap and planetColorMap.
You generate the planet data structure like this example for a gray scale image of Pluto; the replication of the image map is needed because the png is gray scale.
p = imread('pluto.png'); p3(:,:,1) = p; p3(:,:,2) = p; p3(:,:,3) = p; planet.planetMap = p3; planet.radius = Constant('equatorial radius pluto'); planet.name = 'Pluto';
The planetColorMap is not needed if the planetMap is true color, with channels for R, G, B (m x n x 3).
The radius field may be an array of semimajor axes, (1x3). See Ellipsd.
p = Map( planet, mType, noNewFig )
planet (1,:) Any planet mat-file name or the structure planet.planetMap planet.planetColorMap planet.radius mType (2,:) '2d' or '3d', default is '3d' noNewFig (1,1) If entered, don't create a new figure.
p (.) Planet image data structure
function MapIOPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create an MapIO plug in for the ControlDesignGUI.
x = MapIOPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function MassPressureVessel | ( | in | d, |
in | t, | ||
in | rho, | ||
in | type | ||
) |
Computes the mass of a pressure vessel.
Cylindrical vessels include a spherical cap. The default type is 'cylinder'.
Type MassPressureVessel for a demonstration of a 0.2 m and 1.0 m long pressure vessel made of titanium.
m = MassPressureVessel( d, p, sigma, type )
d (1,1) Radius for sphere [radius length] for cylinder (m) t (1,:) Thickness (mm) rho (1,1) Density type (1,:) 'cylinder' or 'sphere'
m (1,:) Mass (kg)
function MassProp | ( | in | inr, |
in | m, | ||
in | cM, | ||
in | u, | ||
in | cName, | ||
in | c | ||
) |
Compute inertia, mass and center of mass for a collection of rigid bodies.
If no output is specified it will print the results. The cm's must be given in the core frame but the inertias may be given in their own frame and the transformation from the component frame to the core frame given in c.
[inrT, mT, cMT, inrP, cP] = MassProp( inr, m, cM, u, cName, c )
inr (6,:) Inertia matrices. Each column is [Ixx;Iyy;Izz;Ixy;Ixz;Iyz] Ixy,Ixz and Iyz may be omitted for all bodies. m (1,:) Masses cM (3,:) Center of masses. Each column is [x;y;z] u (3,1) Units 'sgF' = slug-ft^2, 'sgI' = slug-in^2, 'mks' = metric 'inL' = in-lbf-sec^2; cName (:,:) Component name c (9,:) Transformation matrices. Each column is [c(:,1);c(:,2);c(:,3)]; Transforms from the core frame to the element frame
inrT (3,3) Inertia matrix mT (1,1) Mass cMT (3,1) Center of mass inrP (3,3) Inertia matrix in principal axes cP (3,3) Transformation matrix from core to principal axis such that inrP = cP'*inrT*cP
function MassPropertiesSolidObjFile | ( | in | fileName, |
in | mass, | ||
in | scale | ||
) |
Computes a mass properties data structure from an obj file.
This assumes that the solid is simple without holes.
Type MassPropertiesSolidObjFile for sphere and box examples.
[m, vol] = MassPropertiesSolidObjFile( fileName, mass, scale )
fileName (1,:) File name or data structure mass (1,1) Mass (default is 1) scale (1,1) Scale factor
m (1,1) Mass data structure .mass (1,1) Mass .cM (3,1) Center-of-mass .inertia (3,3) Inertia matrix vol (1,1) Volume
function MassPropertiesTetrahedron | ( | in | v, |
in | rho | ||
) |
Compute inertia, volume and center of mass of a uniform tetrahedron.
Type MassPropertiesTetrahedron for a demo
Usage: [m, vol] = MassPropertiesTetrahedron( v, rho )
v (3,4) Edge vectors rho (1,1) Density
m (1,1) Mass data structure .mass (1,1) Mass .cM (3,1) Center-of-mass .inertia (3,3) Inertia matrix vol (1,1) Volume
Reference: R. Baber, "Rigid Body Simulation," August 2006, pp 13-15.
function MassStructure | ( | in | mass, |
in | type, | ||
in | info, | ||
in | cM | ||
) |
Create a mass data structure.
m = MassStructure( mass, type, info, cM ) m = MassStructure( mass, inr, cM )
mass (1,1) Mass type (1,:) Type of body or (3,3) Inertia matrix info (:,:) Dimensions depends on type see Inertias cM (3,1) Center-of-mass location
m (1,1) Structure .mass (1,1) mass .inertia (3,3) Inertia matrix .cM (3,1) Center of mass
function Mat2Eul | ( | in | m, |
in | e | ||
) |
function Mat2Q | ( | in | m | ) |
Converts a transformation matrix to a quaternion.
Does not check to see that m is orthonormal.
q = Mat2Q ( m )
m (3,3) Orthonormal transformation matrix
q (4,1) Equivalent quaternion
References: Shepperd, S. W., Quaternion from Rotation Matrix, J. Guidance, Vol. 1, No. 3, May-June, 1978, pp. 223-224.
function MatrixCellTo3D | ( | in | c | ) |
function MatrixDisplay | ( | in | x, |
in | f | ||
) |
function MatToCell | ( | in | m | ) |
function MeasNLSpring | ( | in | x, |
in | d | ||
) |
function MeasPartialNLSpring | ( | in | x, |
in | d | ||
) |
function MeasSpring | ( | in | x, |
in | ignoredArg | ||
) |
function MergeConstantDB | ( | in | action, |
in | a, | ||
in | b | ||
) |
Merges b into a using a GUI.
The new file is saved as "NewDB.mat".
MergeConstantDB( action, a, b )
action (1,:) Action to be taken a (1,:) Database to be merged and merged project b (1,:) Database to be merged
h (:) GUI struct
Referenced by CreateGUI().
function Mesh2 | ( | in | xCol, |
in | yRow, | ||
in | z, | ||
in | xLbl, | ||
in | yLbl, | ||
in | zLbl, | ||
in | figTitle | ||
) |
Draws mesh plots with axis labels.
If either xCol or yRow are a scalar, draws a 2 dimensional plot. Rows of z are y and columns are x. An example:
x = 1:10; y = 1:20; z = y'*x; Mesh2(x,y,z,'X','Y','Z')
hFig = Mesh2( xCol, yRow, z, xLbl ,yLbl, zLbl, figTitle )
xCol Column Indices yRow Row indices z Z values xLbl X label yLbl Y label zLbl Z label title figTitle
hFig (1,1) Figure handle
function Mesh3DMF | ( | in | v, |
in | vM, | ||
in | fileName, | ||
in | colorAtt | ||
) |
Generate a 3DMF file for a mesh.
This function will append ".t3d" to the file.
The vertices in the vertex list must be in order, for example if the following are the vertices of a rectangle
1 2 4 3
they must be entered as [1;2;3;4]. colorAtt is vertex color information. One column vector is entered per vertex. The column vector is composed of
[ RGBDiffuse; RGBSpecular; SpecularExponent; RGBTransparency]
Each RGB variable is a column vector [r;g;b] where r,g and b are between 0 and 1. SpecularExponent is > 1 and can be large.
Mesh3DMF( v, vM, fileName, colorAtt )
v (3,:) Vertices vM (:,:) Vertex map. Must be in order. fileName (:) Filename colorAtt (10,:) Color information [[r;g;b];[r;g;b];e;[r;g;b]]
None
function MeshEllipsoid | ( | in | a, |
in | b, | ||
in | c, | ||
in | n | ||
) |
function MeshSOR | ( | in | fZOfR, |
in | nTheta, | ||
in | nR, | ||
in | rMax | ||
) |
Create a polygonal mesh from a surface of revolution.
The origin is always [0;0;0] and the surface is symmetric about z.
[s, n, a] = MeshSOR( fZOfR, nTheta, nR, rMax )
fZOfR (1,:) String giving the function. For example 'r.^2' or 'cos(r)' nTheta (1,1) Number of divisions in theta nR (1,1) Number of divisions in r rMax Maximum radius
s (3,:) Position vectors to the geometric center of each polygon n (3,:) Surface normals of each polygon a (1,:) Area of each polygon
function MeshToPatch | ( | in | x, |
in | y, | ||
in | z, | ||
in | vIn, | ||
in | fIn | ||
) |
Convert a mesh to a patch.
If the arguments v and f are input it will add the new mesh to the existing patch. The mesh will be converted into triangles.
[v, f] = MeshToPatch( x, y, z )
x (:,:) X positions of mesh y (:,:) Y positions of mesh z (:,:) Z positions of mesh vIn (n,3) Vertices fIn (m,3) Faces
v (n,3) Vertices f (m,3) Faces
function MessageQueue | ( | in | action, |
in | modifier, | ||
in | msg, | ||
in | ignoredArg | ||
) |
Creates a message queue GUI.
Once opened, it stays open.
It accumulates messages from any function that sends messages to the queue. Add this to your code whenever you want a to alert the user to an error. MessageQueue('add', myFunction ,'The error','error'); Add this to your code whenever you want a to send the user a message. MessageQueue('add', myFunction ,'The message'); You can turn on a sound notification. Use MessageQueue( 'sound on' ).
MessageQueue( action, modifier, msg, err )
action (1,:) Action to be taken modifier (1,:) Action modifier msg (1,:) Message err (1,:) If anything entered an error
none
function MJD2JD | ( | in | mJD | ) |
function MLog | ( | in | action, |
in | text, | ||
in | index | ||
) |
Message log.
Keeps an ordered, scrollable set of messages.
Type MLog('demo') for an example.
MLog('init') % Initialize a new blank MLog window MLog('init',text) % Initialize a new blank MLog window with text MLog('name',name) % Use the supplied name in the figure heading MLog('add',text) % Append text as new element at end of the set MLog('add',text,k) % Append text to end of the kth element of the set MLog('add',text,0) % Append text to end of the last element of the set MLog('show',k) % Show the kth element of the set MLog('reset') % Delete stored text array and reset display t = MLog('get',k) % Return text of kth element
action '' Can be: {init, name, add, reset, get} text '' Text to store in MLog window index (1,1) Optional. Index of text cell array.
t '' Text of kth element if called as t = MLog('get',k)
References get().
function ModalReductionPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create a ModalReduction plug in for the ControlDesignGUI.
Typing ModalReductionPlugIn is the same as
ModalReductionPlugIn('initialize')
x = ModalReductionPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function ModalTransform | ( | in | g | ) |
Transform the system a,b,c,d into modal form.
Creates a balanced realization of the system then uses the eigenvectors to transform into modal coordinates. The retained modes are specified by k.
Type ModalTransform for a demo.
g = ModalTransform( g )
g (:) State space system
g (:) Modal form
function ModelPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create an Model GUI plug in.
x = ModelPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function MSR | ( | in | g, |
in | q | ||
) |
Mean squared response of a system.
It will use the e matrix for the input matrix. If that matrix is empty it will use the b matrix.
[x, y] = MSR( g, q )
g State space system q Spectral density of the white noise process for 's' or mean squared value for 'z' or 'delta'
x (:) State response y (:) Measurement response
Reference: Bryson, A.E. Jr., "Control of Spacecraft and Aircraft", Princeton University Press, Princeton, NJ, pp.346-348.
function ND2SS | ( | in | num, |
in | den | ||
) |
Creates state-space model from numerator and denominator polynomials.
Creates state-space model given a denominator polynomial and a set of numerator polynomials. The state-space model will be of the form . x = ax + bu y = cx + du where each row of C corresponds to a row of num. The output is in terms of phase variables, also known as the control canonical form.
[a, b, c, d] = ND2SS( num, den )
num Numerator polynomial(s) one output per row den Denominator polynomial
a Plant matrix b Input matrix c Output matrix
References: Schultz, D. G., J. L. Melsa, State Functions and Linear Control Systems, McGraw-Hill, New York, 1967, p. 40.
function NewFig | ( | in | x, |
in | varargin | ||
) |
Creates a new figure.
Sets the default axes font size to 12. Applies the global fontSizeIncrease in addition to the 12 pt, if defined. Tags the figure with 'PlotPSS' for use with DemoPSS.
h = NewFig( x, varargin )
x (:) Name for the figuref varargin {} Parameter pairs to pass to figure()
h Handle
function NLFilter | ( | in | f, |
in | h, | ||
in | x, | ||
in | t, | ||
in | k, | ||
in | u, | ||
in | y, | ||
in | dT | ||
) |
Implements a nonlinear fixed gain filter.
Implements a nonlinear fixed gain filter of the form dx/dt = f(x,u,t) + k*(y - h(x,u,t)) f and h are strings giving the names of functions. f is of the form f( x, t, u, k, y, h ) h is of the form h( x, u, t ) A 4th order Runge-Kutta is used to propagate the equations of motion.
x = NLFilter( f, h, x, t, k, u, y, dT )
f Right hand side of the differential equations h Measurement equations x State vector t Time k Gain matrix u Known inputs y Actual measurements dT Time step
x State vector
function Normal | ( | in | v | ) |
function NormalizePlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create the Normalize GUI plug in used by DetectionFilterBuilder.
x = NormalizePlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function Notch | ( | in | Kdb, |
in | wc, | ||
in | dw, | ||
in | fType, | ||
in | tSamp, | ||
in | sType | ||
) |
Creates a second order transfer function.
Creates a second order transfer function to produce a large + or - gain at frequency wc.
s^2/wc^2 + 2 zzs/wc + 1 K(s) = ------------------------ s^2/wc^2 + 2 zps/wc + 1 For a bandpass with infinite gain at wc enter inf for Kdb. For a notch with zero gain at wc enter NaN. Any argument for fType will make the filter nonminimum phase. Implement this as x[k] = ax[k-1] + bu[k] u[k] = cx[k] + du[k]
[a, b, c, d] = Notch( Kdb, wc, dw, fType, tSamp, sType )
Kdb Peak gain (db) wc Notch frequency (rad/sec) dw Half notch width (rad/sec) fType 'nmp' means nonminimum phase notch, 'mp' is minimum phase tSamp Sampling frequency sType State equation type ('Delta' or 'Z')
a Plant matrix b Input matrix c Measurement matrix d Feedthrough matrix
References: Wie, B., K. Byun, "New Generalized Structural Filtering Concept for Active Vibration Control Synthesis," J. Guidance and Control, Vol. 12, No. 2, March-April 1989, pp. 147-154.
function NPlot | ( | in | yLabels, |
in | y, | ||
in | x, | ||
in | xAxisLabel, | ||
in | yAxisLabel, | ||
in | plotTitle, | ||
in | figTitle | ||
) |
NPlot generates a plot on which the ylabels are character strings.
The y data is assumed to be integers with each integer corresponding to a label given in yLabels. Will generate a new figure if figTitle is entered.
Any input, except yLabels and y may be [].
NPlot( yLabels, y, x, xAxisLabel, yAxisLabel, plotTitle, figTitle )
yLabels Labels for the y-axis corresponding to integral values of y. y y-data x x-data xAxisLabel The x-axis label yAxisLabel The y-axis label plotTitle The plot title figTitle The figure title
none
function NQuant | ( | in | lSB, |
in | rType | ||
) |
function Num2Str1Line | ( | in | n, |
in | d | ||
) |
function NumericalTransferFunction | ( | in | f, |
in | dT | ||
) |
Computes a numerical transfer function from the impulse response.
This function uses an fft but effectively it is integrating exp(-st)*f(t) dt from zero to infinity. If the system is not damped, the results will be poor. For fastest results the number of samples should be a power of two. For a demo type: NumericalTransferFunction
[l, w] = NumericalTransferFunction( f, dT )
f (1,n) Impulse response dT (1,1) Time step
l (3,n) Complex output w (1,n) Frequencies
function Nyquist | ( | in | varargin | ) |
Generate a Nyquist plot from a statespace object or gain/phase data.
Type Nyquist for a demo.
[x,y] = Nyquist( g ) [x,y] = Nyquist( g, w ) [x,y] = Nyquist( g, w, iU, iY ) [x,y] = Nyquist( gain, phase )
g (.) Statespace object (see "statespace") w (.) Frequency vector [rad/s] iU (1) Input index iY (1) Output index
gain (1,:) Magnitude from frequency response (see "FResp") phase (1,:) Phase from frequency response [deg]
x (1,:) x-axis data, gain*cos(phase) y (1,:) y-axis data, gain*sin(phase)
function ODETimeDisplay | ( | in | time, |
in | ignoredArg, | ||
in | action, | ||
in | varargin | ||
) |
Displays an estimate of time to go, compatible with ode113.
Pass this function as an outputfcn for a MATLAB ODE. Opens a window displaying the percent complete and an estimate of the time to go. Updates at 0.5 sec intervals. The time to go will not be exact, as the ode is calculating variable time steps, but will become more accurate as the sim progresses.
You can only have one ODETimeDisplay operating at once.
status = ODETimeDisplay( tspan, y0, 'init' ) status = ODETimeDisplay( t, y, '' ) status = ODETimeDisplay( [], [], 'done' )
time (n) Time y (n,1) Data (currently unused) action (1,:) 'init', '', or 'done'
None
function OGram | ( | in | a, |
in | c | ||
) |
function OpenFile | ( | in | path, |
in | file, | ||
in | suffix, | ||
in | heading, | ||
in | permission | ||
) |
Open a file using a GUI if it is not specified.
[fId, file, path] = OpenFile( path, file, suffix, heading, permission )
path (1,:) Path to file file (1,:) File name suffix (1,:) Suffix (*.suffix) for the file heading (1,:) Heading at top of dialog box permission (1,:) Permission. Default is r+
fID (1,1) File ID (-1 is failure) file (1,:) File name path (1,:) Path to file
function OpenFrame | ( | in | x, |
in | y, | ||
in | h, | ||
in | t | ||
) |
Generate an open frame.
The panel fits into the frame and the frame is fastened to struts to form a satellite frame. The following runs around the periphery. The inner dimensions are x by y. The thickness (in z) is h. The frame is t by t.
With no outputs this generates a picture. Type OpenFrame for a demo.
[v, f, vol] = OpenFrame( x, y, h, t )
x (1,1) Width of the panel (x) y (1,1) Length of the panel (y) h (1,1) Panel thickness t (1,1) Frame thickness
v (:,3) Vertices f (:,3) Faces vol (1,1) Volume of material
function OscillatorRHS | ( | in | x, |
in | ignoredArg, | ||
in | u, | ||
in | mass, | ||
in | omega | ||
) |
function P3Axis | ( | in | qECIToBody, |
in | d | ||
) |
A 3-axis proportional controller.
The control acceleration is equal to the angle error times the gain. Use max_angle to limit the maximum requested angular change per step. The control target is a desired quaternion. The axis and angle are used only to create a prior target on initialization.
Forms:
d = P3Axis; [torque, d] = P3Axis( qECIToBody, d )
Input
qECIToBody (4,1) ECI to body quaternion d (.) Data structure .gain (1,1) Control gain .q_desired_state (4,1) Target quaternion . .q_target_last (4,1) Last target .axis (3,1) Axis of rotation .angle (1,1) Angular increment around axis .max_angle (1,1) Maximum angle per step (rad) .inertia (3,3) Inertia
Output
torque (3,1) Control torque d (.) Data structure
function ParabolicReflector | ( | in | d, |
in | f, | ||
in | m, | ||
in | p | ||
) |
Generate a parabolic reflector.
The reflector normal is along +z and the origin is at z = 0. a, n and r include both front and back.
ParabolicReflector will draw the reflector if no outputs are requested.
Type ParabolicReflector for a demo.
[v, f, a, n, h, theta0] = ParabolicReflector( d, f, m, p )
d (1,1) Diameter (m) f (1,1) Focal length (m) m (1,1) Number of azimuth divisions (optional) p (1,1) Number of elevation divisions (optional)
v (:,3) Vertices f (:,3) Faces a (1,:) Areas (m^2) n (3,:) Normals r (3,:) Vectors to the center of each triangle (m) h (1,1) Vertical height of the reflector (m) theta0 (1,1) Angle from the antenna base to the edge (rad)
Reference: The Parabolic Reflector Antenna (Satellite Dish) http://www.antenna-theory.com/antennas/reflectors/dish.php
function Parallel | ( | in | a1, |
in | b1, | ||
in | c1, | ||
in | d1, | ||
in | a2, | ||
in | b2, | ||
in | c2, | ||
in | d2 | ||
) |
Parallel connects two state space models.
Both systems feed off of the same input and the outputs are the sum of the individual systems outputs. The resulting system is [a1 0] [b1] [c1 c2] d1+d2 [ 0 a2] [b2]
[a, b, c, d] = Parallel( a1, b1, c1, d1, a2, b2, c2, d2 )
a1 Plant matrix b1 Input matrix c1 Measurement matrix d1 Input feedthrough matrix a2 Plant matrix b2 Input matrix c2 Measurement matrix d2 Input feedthrough matrix
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix
References: Maciejowski, J. M., Multivariable Feedback Design, Addison-Wesley, Reading, MA, 1989, p. 373.
function PartialDisk | ( | in | r, |
in | t, | ||
in | n, | ||
in | angle | ||
) |
Generate vertices and faces for a full or partial disk.
The axis of rotation is z. Type PartialDisk for a demo showing a full disk and a quarter disk.
[v, f] = PartialDisk( r, t, n, angle )
r (1,1) Radius t (1,1) Thickness n (1,1) Number of divisions, optional, default 20 angle (1,2) [start stop], default is 0 to 2*pi
v (:,3) Vertices f (:,3) Faces
function PathDirectories | ( | ) |
function PDDesign | ( | in | zeta, |
in | wN, | ||
in | wD, | ||
in | inr, | ||
in | tSamp, | ||
in | sType | ||
) |
Design a PD controller.
Design a PD controller of the form x = x + ax + bu y = cx + du If no outputs are requested then Bode plots for the controller will be drawn.
[a, b, c, d] = PDDesign( zeta, wN, wD, inr, tSamp, sType )
zeta Damping ratio wN Undamped natural frequency wD Derivative term cutoff inr Axis inertia tSamp Sampling period* sType State equation type ('Delta' or 'Z')* * optional - default is a continuous controller
a Plant matrix b Input matrix c Output matrix d Feedthrough matrix
function PGains | ( | in | g, |
in | k, | ||
in | w | ||
) |
Compute the principal gains for a system.
Compute the principal gains for a system of the form
- | | | | -------------------
PGains( g, k, w )
g Plant model of type statespace k Controller structure of type statespace w Frequency vector
None
References: Maciejowski, J.M. (1989). Multivariable Feedback Design. Addison-Wesley, Reading, MA, 76-91.
function PhasePlane | ( | in | v, |
in | x, | ||
in | k, | ||
in | db, | ||
in | rl | ||
) |
Implements a phase plane controller.
The optimality condition is J = T + k*integral[0,T]( |u| dt ) where u is the control and T is the final time. The solution consists of two switching curves. When k is inf you get the time-optimal solution with one switching curve. If k > 0 you will get two switching curves. The former is known as a "bang-bang" controller and the latter a "bang-zero-bang" controller. The deadband separates the switching curves at the origin by db. The rate limit sets u = 0 if the state is within the control. Type PhasePlane for a demo.
u = PhasePlane( v, x, k, db, rl )
v (1,1) Rate x (1,1) Position k (1,1) Weight on time db (1,1) Deadband rl (1,1) Rate limit
u (1,1) Control [-1;0;1]
Reference: Athans, M. and P. L. Falb. (1966.) Optimal Control Lincoln Laboratory Publication.
function PID | ( | in | kF, |
in | kP, | ||
in | kR, | ||
in | kI, | ||
in | omegaR, | ||
in | tSamp, | ||
in | sType | ||
) |
Design a PID controller.
Design a PID controller of the form y = cx + du x = ax + bu Type PID for a demo.
[g, b, c, d] = PID( kF, kP, kR, kI, omegaR, tSamp, sType )
kF Forward gain kP Proportional gain kR Rate gain kI Integral omegaR Rate cutoff tSamp Sampling period (sec) sType State equation type ('Delta' or 'Z')
g Statespace data structure or [a, b, c, d] Statespace
function PIDesign | ( | in | zeta, |
in | wN, | ||
in | inr, | ||
in | tSamp, | ||
in | sType | ||
) |
Design a PI controller.
Design a PI controller of the form y = cx + du x = ax + bu using pole placement. Inputs are the damping ratio and undamped natural frequency of the desired closed loop poles. If no outputs are requested then Bode plots for the controller will be drawn. To ensure that the gain at ƒ is less than 1 make certain that 2*zeta*wN*inr < 1
[a, b, c, d, wC, k] = PIDesign( zeta, wN, inr, tSamp, sType )
zeta Damping ratio wN Undamped natural frequency inr Axis inertia tSamp Sampling period sType State equation type ('Delta' or 'Z')
a Plant matrix b Input matrix c Output matrix d Feedthrough matrix wC 0 dB Crossover k Gain at infinity
function PIDMIMO | ( | in | inr, |
in | zeta, | ||
in | omega, | ||
in | tauInt, | ||
in | omegaR, | ||
in | tSamp, | ||
in | sType | ||
) |
Produces a state space n degree of freedom PID controller.
The PID controller will be of the form: x(k+1) = a x(k) + b u(k) y(k) = c x(k) + d u(k) By designing in the frequency domain and converting to discrete time using a zero-order hold. The inputs are the desired damping ratio and undamped natural frequency of the complex mode of the closed-loop system and the time constant of the integrator. This system does not compensate for the phase lag of the zero order hold and is only applicable to systems where the bandwidth is much lower than the half-sampling frequency. The continuous time equivalent for each axis is Kr s u y = Kp u + ---- u + Ki --- s + wR s The function converts the result to discrete time if tSamp is entered. If only one output is requested it will return a data structure with the matrices.
[a, b, c, d, k] = PIDMIMO( inr, zeta, omega, tauInt, omegaR, tSamp, sType )
inr (n,n) Inertia matrix zeta (n,1) Vector of damping ratios omega (n,1) Vector of undamped natural frequencies tauInt (n,1) Vector of integrator time constants omegaR (n,1) Vector of derivative term roll-off frequencies tSamp Sampling period sType State equation type ('Delta' or 'Z' (default))
a (2n,2n) Plant matrix b (2n, n) Input matrix c ( n,2n) Output matrix d ( n, n) Feedthrough matrix k Gains .kP Proportional .kR Rate .kI Integral
function PIDProper | ( | in | KP, |
in | KI, | ||
in | KD, | ||
in | wR, | ||
in | w | ||
) |
Compute proper and non-proper transfer functions for a PID.
Compute proper and non-proper transfer functions for a set of PID gains Call with no inputs to use default data for a demo. Call with no outputs to produce a plot. The transfer function from u to y is of the form: KD s u y = KP u + ---- u + KI --- s + wR s Notice that with smaller wR, the proper transfer function matches the original PID (non-proper) transfer function over a higher frequency range.
data = PIDProper( KP, KI, KD, gamma );
KP (1,1) Proportional gain KI (1,1) Integral gain KD (1,1) Derivative gain wR (1,1) Derivative roll-off term w (1,:) Frequency vector. Optional, default: logspace(-3,2)
data (.) Data structure with fields: - num Numerator of proper TF - den Denominator of non-proper TF - numNP Numerator of proper TF - denNP Denominator of non-proper TF - a A matrix of proper statespace - b B matrix of proper statespace - c C matrix of proper statespace - d D matrix of proper statespace - mag Magnitude response of proper TF - phase Magnitude response of proper TF - magNP Magnitude response of proper TF - phaseNP Magnitude response of proper TF
function PIDWithLag | ( | in | d | ) |
Creates a PID controller with lag compensation.
Creates a PID controller when there is a lag that you wish to approximately compensate. You enter the ideal integrator time constant, the damping ratio and undamped natural frequency of the complex pole pair. You then select a range of frequencies about you which to compensate for the lag.
Type PIDWithLag for a demo.
y = PIDWithLag( d )
d (1,1) Data structure .a Integrator time constant .zeta Damping ratio .wN Undamped natural frequency .tau lag .w Range of frequencies to minimize lag effect .k Forward gain (e.g 1/mass or 1/inertia)
y (:) .kI Integral gain .kP Proportional gain .kD Derivative gain .mI Ideal Integral gain .mP Ideal Proportional gain .mD Ideal Derivative gain
function PILeaky | ( | in | k0, |
in | kInf, | ||
in | w0Db, | ||
in | tSamp, | ||
in | sType | ||
) |
Design a leaky PI controller.
Design a PI controller of the form
y = cx + du x = ax + bu The transfer function is K ( 1 + 1 ) -------- tau(s+a) The inputs are gain at zero, gain at infinity and 0 dB crossover frequency. If the gain at zero frequency is not infinity you get a "leaky" integrator. Leaky integrators can give you sufficient gain a DC for your application with giving you the stability problems of regular integrators. With one output, the routine will give you the conventional statespace form [a, b, c, d]. With one output you will get an object of the statespace class. If the gain at infinity is greater than 1, w0Db is the corner frequency. Type PILeaky for a demo.
[g, b, c, d] = PILeaky( k0, kInf, w0Db, tSamp, sType )
k0 Gain at zero (may be inf) (dB) k Gain at infinity (forward gain) (dB) w0Db 0 db crossover (rad/sec) tSamp Sampling period (sec) sType State equation type ('Delta' or 'Z')
g Statespace data structure or [g, b, c, d] Statespace
function PlateTwoSided | ( | in | x, |
in | y, | ||
in | z | ||
) |
Generate a plate in the xy plane.
Only 4 corners allowed. For correct lighting points must be entered counterclockwise:
4 3 +Y ---------— ^ | | | | | | ---------— --—> +X 1 2
Type PlateTwoSided for a demo.
[v, f] = PlateTwoSided( x, y, z )
x (1,4) x points y (1,4) y points z (1,1) z
v (4,3) Vertices f (4,3) Faces
function PlaybackControls | ( | in | valMin, |
in | valMax, | ||
in | val0, | ||
in | callback, | ||
in | dx, | ||
in | name, | ||
in | position | ||
) |
Create a GUI with playback controls.
Type PlaybackControls for a demo.
PlaybackControls( valMin, valMax, val0, callback, dx, name, position )
valMin (1,1) Minimum value for slider bar valMax (1,1) Maximum value for slider bar val0 (1,1) Initial value of slider callback Callback function, 1 var. Example: @(x) disp(sin(x)) dx (1,1) Incremental change in x name (1,:) String name for figure (optional) position (1,4) Position in pixels of the figure
None
References set().
function Plot2D | ( | in | x, |
in | y, | ||
in | xL, | ||
in | yL, | ||
in | figTitle, | ||
in | plotType, | ||
in | iY, | ||
in | iX, | ||
in | nCols, | ||
in | pThresh, | ||
in | figBackColor, | ||
in | leg | ||
) |
Easily build a versatile 2D plot page consisting of any number of plots.
Data is indexed into a subplot grid and labels are applied automatically. The data series must be in rows. Any of the inputs, except y, may be omitted or [].
The elements of iY indicate what rows of the y matrix should be plotted on each subplot. If iY is not entered the number of y-axis labels will determine the number of plots on the page. The number of rows of x must equal the number of x labels. If you enter only one row of x it will be used for all plots without the need to enter iX. Otherwise, the elements of iX indicate which rows of the x matrix should be used for each subplot.
For example, to plot a position in a (3,n) matrix:
Plot2D( t, r, 'Time', {'X','Y','Z'}, 'Position Vector' )
or even just
Plot2D( t, r )
To plot this position overlaid with a target,
Plot2D(t,[r;rT],'Time',{'X','Y','Z'},'Position Vector',[],{'[1 4]','[2 5]','[3 6]'})
This function has a built-in demo with 4 subplots showing indexing. Type Plot2D for the demo.
[h, hA] = Plot2D( x, y, xL, yL, figTitle, plotType, iY, iX, nCols, pThresh, figBackColor, leg )
x (m,:) x values y (n,:) y values xL (m,:) or {m} x-axis label(s) yL (n,:) or {n} y-axis label(s) figTitle (:) Figure title plotType (n,4) or {n} Type of axes 'xlog', 'ylog', 'log', 'lin'. 'lin' is the default. iY (n,:) or {n} Index. Indexes Y data to plots. Each row or cell gives the indexes of the data that go on that plot. This is a string, either '[1 2 3 4]', '1:3', or an array. iX (n,1) Index. Indexes X data to plots. Each row gives the indexes of the x data that goes with that plot. nCol (1,1) Number of columns. pThresh (1,1) Minimum plot resolution. Set to 2.220446049250313e-10 for PowerPC Prevents a MATLAB warning that appears in V5.x. figBackColor (1) Flag for fig background color (0 - grey, 1 - white) leg {} Add legends for each plot {{'a', 'b', 'c'},{'x','y'}}
h (1,1) Figure handle hA (:) Data structure of handles to line objects .h
function Plot3D | ( | in | r, |
in | xL, | ||
in | yL, | ||
in | zL, | ||
in | figTitle, | ||
in | rPlanet, | ||
in | figBackColor | ||
) |
Create a 3-dimensional plot.
[h, hA] = Plot3D( r, xL, yL, zL, figTitle, rPlanet, figBackColor )
r (3,:) x, y, z values xL (n,:) x-axis label yL (n,:) y-axis label zL (n,:) z-axis label figTitle Figure title rPlanet (1,1) Radius of planet sphere figBackColor (1) Flag for fig background color (0 - grey, 1 - white)
h (1,1) Figure handle hA (:) Data structure of handles to line objects .h
function Plot3Vector | ( | in | time, |
in | vector, | ||
in | title | ||
) |
Plot a 3 vector as x, y, z subplots as well as a combined plot.
Creates 4 subplots. This function has a built-in demo; type Plot3Vector for a demo.
h = Plot3Vector( time, vector, title )
time (1,:) Time vector, in seconds vector (3,:) Vector data title (:) Title string for plot
h (1,1) Figure handle
function PlotAngleRange | ( | in | varargin | ) |
function PlotArrays | ( | in | action, |
in | d, | ||
in | varName, | ||
in | varargin | ||
) |
Manage a set of arrays for plotting simulation data.
Initialize the arrays, store plot points, then obtain arrays. The data is stored internally as multi-dimensional arrays, i.e.
data(m,n,p,...,i,j,k)
For a simple simulation, numberPts is just the size of the simulation loop, for example 100. If you are generating three runs of the same simulation you can pass in [3 100] instead.
The log actions do not run checks for speed. If you attempt to log a variable that you have not added you will get an error.
Forms: d = PlotArrays( 'init', numberPts ) d = PlotArrays( 'add', d, varName, x0 ) d = PlotArrays( 'log', d, varName, index, value ) d = PlotArrays( 'logmulti', d, {varNames}, index, {values} ) x = PlotArrays( 'get', d, varName )
Inputs:
action (:) String with the action name d (1,1) Structure from previous calls
varName (:) String with the variable name numberPts (1,k) The dimensions of the simulation x0 (m,n,p,...) An example of the variable index {1,k} Indices of the data point in a cell array value (m,n,p,...) Value to be stored
Outputs:
d (.) Data structure
function PlotColor | ( | in | k | ) |
function PlotDoubleYAxis | ( | in | x, |
in | yL, | ||
in | yR, | ||
in | xLabel, | ||
in | yLabelL, | ||
in | yLabelR, | ||
in | title, | ||
in | name, | ||
in | tL, | ||
in | tR | ||
) |
Generates a plot with two y axes.
yL and yR must be 1 by n arrays. x must be 1 by n. If yL is more than one line and the yR has the same number of lines it will match the line colors.
Type PlotDoubleYAxis for a demo.
[hR, hL] = PlotDoubleYAxis( x, yL, yR, xLabel, yLabelL, yLabelR, title, name, tL, tR )
x (1,:) x data yL (1,:) Left y axis data yR (1,:) Right y axis data xLabel (1,:) x label yLabelL (1,:) Left y label yLabelR (1,:) Right y label title (1,:) Figure title name (1,:) Figure name tL (1,:) Type of right plot 'lin', 'ylog' tR (1,:) Type of right plot 'lin', 'ylog'
hR (1,1) Handle to right plot hL (1,1) Handle to left plot
function PlotF | ( | in | action, |
in | y, | ||
in | t, | ||
in | g | ||
) |
Create any number of plot pages in one call.
Utilizes Plot2D.
The function is called as:
g = PlotF( 'initialize', [], [], g ); g = PlotF( 'add points', y, t, g ); PlotF( 'plot', g )
All data is stored in g so this function may be called multiple times.
g = PlotF( action, y, t, g )
action (1,:) Action string y (:,1) Vector to plot t (1,1) Time (sec) g (:) Data structure .xLabel .yLabel {:} Cell array with y labels .n (1,1) Number of plot points .page {} Cell array with indices to plots on each page .title {} Title for each page ax (1,1) Handle to an axes
g (:) Data structure
function PlotPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position | ||
) |
Plot a variable number of points.
The function is called as:
PlotPlugIn( 'initialize', g, hFig ); PlotPlugIn( 'add points', tag, struct('y',y,'t',t) ); PlotPlugIn( 'plot', tag ) PlotPlugIn( 'update labels', tag, g ) All data is stored in g so this function may be called multiple times.
tag = PlotPlugIn( action, modifier, hFig, position )
action (1,:) Action modifier (1,:) Modifier to the action. 'initialize' .xLabel {:} Cell array with x labels .yLabel {:} Cell array with y labels .n (1,1) Number of plot points .title {:} Title for each plot 'add points' tag hFig (1,1) 'initialize' Figure handle 'add points' .x(:,1) .y(:,1)
g (:) Data structure
function PlotSet | ( | in | x, |
in | y, | ||
in | varargin | ||
) |
Create two-dimensional plots from a data set.
Plot y vs x in one figure. If x has the same number of rows as y then each row of y is plotted against the corresponding row of x. If x has one row then all of the y vectors are plotted against those x variables.
Accepts optional arguments that modify the plot parameters.
Type PlotSet for a demo.
Form
h = PlotSet( x, y, varargin )
x (:,:) Independent variables y (:,:) Dependent variables varargin {} Optional arguments with values 'x label', 'y label', 'plot title', 'plot type' 'figure title', 'plot set', 'legend', 'line width'
h (1,1) Figure handle
See also Plot2D
function PlotV | ( | in | x, |
in | xLbl, | ||
in | yLbl, | ||
in | zLbl, | ||
in | figTitle | ||
) |
Draws plots of a set of 3*m-by-n vectors in 3D axes.
To plot more than one vector, stack them:
x = [ x1;x2;...]
Does not draw vectors from the origin but rather plots the sequence of the vector tips. See MAPControlSim for an example. Type PlotV for a demo.
PlotV( x, xLbl, yLbl, zLbl, figTitle )
x (3*m,n) Vectors xLbl X label yLbl Y label zLbl Z label figTitle Figure title
None
function PltStyle | ( | ) |
function PoissonsRatio | ( | in | material | ) |
function Polygon | ( | in | v | ) |
Generate the properties for a polygon given vertices in the form v(3,n).
It assumes that the polygon is planar. It computes an average normal at all vertices.
[area, n, r] = Polygon( v )
v (3,:) Vertices
area (1,1) Area of the polygon n (3,1) Normal r (3,1) Geometric center
Reference: Hill, F.S., Jr. Computer Graphics.
function PolygonProps | ( | in | v, |
in | f | ||
) |
function PositionLabel | ( | in | x | ) |
function PrincipalAxes | ( | in | inertia, |
in | u | ||
) |
Computes the principal axes for an inertia matrix.
Input u is a set of vectors for which the routine computes angles between the axes in the base and axes in the principal frame. The inertia matrix in principal axes is m'*inertia*m
[inertiaP, angle, error, m] = PrincipalAxes( inertia, u )
inertia (3,3) The inertia matrix u (3,n) Vectors in the base frame
inertiaP (3,3) The inertia matrix angle (1,n) Angle between u in base and u in principal axes (deg) error (3,3) Error m (3,3) Transformation matrix
function PrintEigenvalues | ( | in | g, |
in | f, | ||
in | t | ||
) |
function PrintFig | ( | in | invertHardCopy, |
in | printType, | ||
in | f, | ||
in | fName, | ||
in | pathName, | ||
in | zBuffer | ||
) |
Prints specified figures to a printer or files.
The figures may be printed to an encapsulated Postscript file, jpeg or png. (For eps will always use -depsc2 -tiff, for jpeg -jpeg90). The default (any number > 3) is pdf, which uses exportgraphics. To send figures to the default printer use 0 for the type parameter.
PrintFig( invertHardCopy, printType, f, fName, pathName, zBuffer )
invertHardCopy If true will invert the color of the printed figure printType If == 1 will make eps file (default); 2, png; 3, jpeg. Greater than 3 prints to a pdf file. To send to the default printer use 0. f Set of figures to print fName File name (no extension) pathName Path to the file zBuffer Print in zbuffer mode (before R2014b)
none
function PrintTitle | ( | in | t | ) |
function ProcessTag | ( | in | action, |
in | tag, | ||
in | k, | ||
in | name | ||
) |
function PropStateSpace | ( | in | g, |
in | x, | ||
in | u | ||
) |
function PWM | ( | in | tau, |
in | tSamp, | ||
in | n | ||
) |
Create a model of a pulsewidth modulator using Padé approximants.
The pulsewidth is assumed fixed at tau. The function includes the sampler gain of 1/tSamp;
[a, b, c, d] = PWM( tau, tSamp, n ) [num, den] = PWM( tau, tSamp, n )
tau (1,1) Nominal pulsewidth tSamp (1,1) Sampling period n (1,1) Number of terms (optional)
a or num Numerator polynomial or plant matrix b or den Denominator polynomial or input matrix c Measurement matrix d Feedthrough matrix
function Q2AU | ( | in | q | ) |
function Q2Eul | ( | in | q, |
in | e | ||
) |
function Q2Mat | ( | in | q | ) |
Converts a quaternion to a transformation matrix.
Does not check to see that m is orthonormal. This routine requires 45 floating point operations.
m = Q2Mat( q )
q (4,1) Equivalent quaternion
m (3,3) Orthonormal transformation matrix
References: Shepperd, S. W., Quaternion from Rotation Matrix, J. Guidance, Vol. 1, No. 3, May-June, 1978, pp. 223-224.
Since version 1.
function QAxisRot | ( | in | qi, |
in | angle, | ||
in | u | ||
) |
function QBToIDot | ( | in | q, |
in | w, | ||
in | dT | ||
) |
Computes the quaternion derivative from angular velocity.
Computes the time derivative of a quaternion that transforms from the body frame to the inertial frame given the angular velocity measured in the body frame.
qD = QBToIDot( q, w ) [a, b, c, d, dqdt] = QBToIDot( q, w ) [a, b, c, d, dqdt] = QBToIDot( q, w, dT )
q (4,1) Quaternion from b to a w (3,1) Rate of b with respect to a measured in b dT (1,1) Time step
qD (4,1) Derivative of Q or a Plant matrix b Input matrix c Measurement matrix d Feedthrough matrix dqdt Constant quaternion derivative
function QCE | ( | in | a, |
in | c, | ||
in | q, | ||
in | r, | ||
in | b, | ||
in | n | ||
) |
Create an estimator from a state space system.
Create an estimator based on the state equations
x = ax + bw y = cx + v
E(ww') = q E(vv') = r E(vw') = n The estimator will be of the form xE = a*xE + b*u + k*(y-c*xE)
[k, sInf] = QCE( a, c, q, r, b, n )
a Plant matrix c Measurement matrix q State noise covariance matrix r Measurement noise covariance matrix b State noise input matrix n State/measurement cost cross-coupling covariance matrix
k Optimal gain sInf Covariance matrix
References: Bryson, A., Y. Ho, Applied Optimal Control, Hemisphere, 1976, 364-373.
function QCR | ( | in | a, |
in | b, | ||
in | q, | ||
in | r, | ||
in | n | ||
) |
Creates a linear quadratic regulator from a state space system.
Create a regulator of the form u = -Kx minimizing the cost functional J = †{(1/2)[u'ru + x'qx] + u'nx + x'nu}dt.
Given the constraint: . x = ax + bu
[k, sinf] = QCR( a, b, q, r, n )
a Plant matrix (N,N) b Input matrix (N,M) q State cost matrix (N,N) r Input cost matrix (M,M) n State/input cost cross-coupling matrix (N,M)
k Optimal gain sinf Solution to the matrix Ricatti equation
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, pp. 435-438.
function QError | ( | in | qRef, |
in | qMeas, | ||
in | ignoredArg | ||
) |
Small angle errors between two quaternions.
This routine gives the correct sign when both vectors transform from frame a to frame b and frame b is the body frame. If the convention is reversed you must reverse the sign. To force the positive first element convention enter any 3rd argment.
angle = QError( qRef, qMeas, pos )
qRef (4,1) Reference quaternion qMeas (4,1) Measured quaternion pos (1,1) If entered make the first element positive always
angle (3,1) Vector of small angular errors (rad)
function QForm | ( | in | q, |
in | ua | ||
) |
Transforms a vector in the direction of the quaternion.
If the number of columns of q is 1 it will transform all of the vectors by that q. If it is greater than 1 it will transform each column of ua by the corresponding column of q. If the number of columns of q is > 1 and the number of columns of ua is 1 it will create one column of ub for every column of q. This routine takes 30 floating point operations.
ub = QForm( q, ua )
q (4,n or 1) Quaternion from a to b ua (3,n or 1) Vector in a
ub (3,n) Vector in b
See also QTForm.
function QFromDQ | ( | in | q, |
in | dQ24 | ||
) |
function QMult | ( | in | Q2, |
in | Q1 | ||
) |
Multiply two quaternions.
Q2 transforms from A to B and Q1 transforms from B to C so Q3 transforms from A to C. If only one argument is input it produces the 4x4 matrix equivalent: q3 = Q2*q1;
Q3 = QMult( Q2 ,Q1 )
Q2 (4,1) Quaternion from a to b Q1 (4,1) Quaternion from b to c
Q3 (4,1) Quaternion from a to c or 4x4 version of q
function QPose | ( | in | q | ) |
function QRand | ( | in | n | ) |
function QTForm | ( | in | q, |
in | ua | ||
) |
Transforms a vector opposite the direction of the quaternion.
If the number of columns of q is 1 it will transform all of the vectors by that q. If it is greater than 1 it will transform each column of ua by the corresponding column of q. If the number of columns of q is > 1 and the number of columns of ua is 1 it will create one column of ub for every column of q.
ub = QTForm( q, ua )
q (4,n or 1) quaternion from a to b ua (3,n or 1) vector in frame b
ub (3,n) vector in frame a See also QForm.
function Quant | ( | in | x, |
in | lsb, | ||
in | rType | ||
) |
function QuickPlot | ( | in | file | ) |
Plots output data from external simulations.
Call with no inputs to select a file manually.
[v, yLbls, time, name] = QuickPlot( file )
file (1,:) File name
v {:} Each cell is a plot {'state' 'output' 'input'} yLbls {:} Each cell is the y-axis name time (1,:) The time data name {:} The plot names
function QUnit | ( | in | q | ) |
function QZero | ( | ) |
function Rad2DMS | ( | in | a | ) |
function Rad2HMS | ( | in | a | ) |
function RaDec2U | ( | in | rA, |
in | dec | ||
) |
function RadioButtons | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | rows, | ||
in | format, | ||
in | cB | ||
) |
Create radio buttons.
Units are pixels. format is a cell array of the orm
{'property1', value, 'property2', value, ... }
To initialize type:
RadioButtons( 'initialize', {'a', 'b', 'c'}, hFig )
tag = RadioButtons( 'initialize', s, hFig, position, rows, format, cB ) x = RadioButtons( 'value', tag ) x = RadioButtons( 'string', tag ) x = RadioButtons( 'show', tag ) x = RadioButtons( 'hide', tag )
action (1,:) Action 'initialize', 'update' modifier (1,:) Modifier to the action hFig (1,1) Handle to the figure or if 'update' radio button handles s {} Cell array of strings position (1,4) [left bottom width height] rows (1,1) Number of rows format {:} Cell array of properties cB (1,:) Callback
x (1,1) Output
function Rates2EulDot | ( | in | e, |
in | w, | ||
in | n | ||
) |
Converts angular velocity into 3-2-1 Euler angle rates.
If only one
input is given, the output is the transformation matrix.
wEul = Rates2EulDot( e, w, n )
e (3) Euler angles w (3) Angular rates n (1) Orbit rate (for rotating frames only, optional)
wEul (3) Euler angle rates
Reference: Hughes, Spacecraft Attitude Dynamics (1986), Table 2.2 p. 27
function ReadCSVTable | ( | in | filename | ) |
Read in tabular data in .csv file and convert it to a structure array.
Textual column headers are required to define structure field names. Type ReadCSVTable for a file selection GUI.
d = ReadCSVTable( filename )
filename (:) Name of .csv file with tabular data
d (.) Data structure array. Each row is a struct element. The structure field names are the column headers.
function RealTimePlot | ( | in | action, |
in | y, | ||
in | t, | ||
in | g | ||
) |
Plot real time.
All data is stored in g so this function may be called multiple times.
g = RealTimePlot( action, y, t, g )
action (1,:) Action y (:,1) Vector to add to plot t (1,1) Time (sec) g (:) Data structure .tLabel .tLim (1,2) [start stop] .yLim (:,2) [min max] if equal RealTimePlot will use [-1 1] .yLabel {:} Cell array with y labels .page {} Cell array with indices to plots on each page .title {} Title for each page
g (:) Data structure
function ReduceModal | ( | in | g, |
in | k | ||
) |
Retain modes k of the system a,b,c,d.
Creates a balanced realization of the system then uses the eigenvectors to transform into modal coordinates. The retained modes are specified by k.
Type ReduceModal for a demo.
g = ReduceModal( g, k )
g (:) State space system k (1,:) Modes to retain
g (:) Reduced state space system
function ReduceOrder | ( | in | g, |
in | k | ||
) |
function ReduceOrderPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create a model order reduction GUI plug in.
ReduceOrderPlugIn('initialize')
x = ReduceOrderPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function ReliabilityMOfN | ( | in | m, |
in | n, | ||
in | mTBF, | ||
in | t | ||
) |
Determine the reliability of a system.
n parallel devices of which m should survive. The reliability is exp(-t/MTBF).
p = Reliability(m,n,mTBF,t)
n (1,1) Number that must survive m (1,1) Number of devices mTBF (1,1) Mean time between failure for each unit (s) t (1,:) Time vector (s), optional (default 0 to 4*mTBF)
p (1,:) Reliability of the system (probability of failure)
Reference: Daniele Veneziano. 1.151 Probability and Statistics in
Engineering. Spring 2005. Massachusetts Institute of Technology: MIT OpenCourseWare, https://ocw.mit.edu. Application note: "RELIABILITY OF SYSTEMS WITH VARIOUS ELEMENT CONFIGURATIONS"
function ReliabilityParallel | ( | in | n, |
in | mTBF, | ||
in | t | ||
) |
Determine the reliability of a parallel system.
Compute the probability of failure for n parallel devices. The reliability is exp(-t/MTBF).
r = ReliabilityParallel(n,mTBF,t)
n (1,:) Number of devices for each MTBF mTBF (1,:) Mean time between failure for each unit (s) t (1,:) Time vector (s), default 0 to 6*max(mTBF)
p (1,:) Probability of failure
Reference: Daniele Veneziano. 1.151 Probability and Statistics in
Engineering. Spring 2005. Massachusetts Institute of Technology: MIT OpenCourseWare, https://ocw.mit.edu. Application note: "RELIABILITY OF SYSTEMS WITH VARIOUS ELEMENT CONFIGURATIONS"
function ReliabilitySeries | ( | in | n, |
in | mTBF, | ||
in | t | ||
) |
Determine the reliability of a series system.
Compute the probability of failure for n series devices. The reliability is exp(-t/MTBF).
p = ReliabilitySeries(n,mTBF,t)
n (1,p) Number of devices mTBF (1,p) Mean time between failure for each unit (s) t (1,:) Time vector (s)
p (1,:) Probability of failure
Reference: Daniele Veneziano. 1.151 Probability and Statistics in
Engineering. Spring 2005. Massachusetts Institute of Technology: MIT OpenCourseWare, https://ocw.mit.edu. Application note: "RELIABILITY OF SYSTEMS WITH VARIOUS ELEMENT CONFIGURATIONS"
function RemoveContentsFile | ( | in | x | ) |
function Rename | ( | in | x, |
in | f | ||
) |
function RequiredFields | ( | in | g, |
in | r | ||
) |
function RFromCPAndGamma | ( | in | cP, |
in | gamma | ||
) |
function RHSDoubleIntegrator | ( | in | x, |
in | ignoredArg, | ||
in | u, | ||
in | mass | ||
) |
function RHSNLSpring | ( | in | x, |
in | ignoredArg, | ||
in | d | ||
) |
Nonlinear estimator spring model.
Has a linear and cubic spring plus a damper.
d = RHSNLSpring; xDot = RHSNLSpring( x, t, d )
x (2,1) State [position;velocity] t (1,1) Time (not used) fData (1,1) Data structure .kL (1,1) Linear spring coefficient .kC (1,1) Cubic spring coefficient .c (1,1) Damping coefficient .f (1,1) Force .x0 (1,1) Nominal x
xDot (2,1) State derivative
function RHSOscillator | ( | in | x, |
in | ignoredArg, | ||
in | u, | ||
in | mass, | ||
in | omega | ||
) |
function RHSPartialNLSpring | ( | in | ignoredArg, |
in | ignoredArg, | ||
in | d | ||
) |
Nonlinear estimator spring model.
Has a linear and cubic spring plus a damper.
d = RHSPartialNLSpring; % data structure a = RHSPartialNLSpring( x, t, d )
x (2,1) State [position;velocity] (not used) t (1,1) Time (not used) d (.) Data structure .kL (1,1) Linear spring coefficient .kC (1,1) Cubic spring coefficient .c (1,1) Damping coefficient .f (1,1) Force .x0 (1,1) Nominal x .m (1,1) Mass
a (2,2) State transition matrix
function RHSSpring | ( | in | x, |
in | ignoredArg, | ||
in | d | ||
) |
function RHSX | ( | in | x, |
in | ignoredArg, | ||
in | d | ||
) |
Right hand side for a one dimensional vertical motion simulation.
Adds Gaussian random variations to the thrust.
d = RHSX; xDot = RHSX( x, t, d )
x (2,1) [x;v] t (1,1) Time (not used) d (1,1) Data structure .m (1,1) Mass .g (1,1) Acceleration of gravity .tNoise (1,1) Standard deviation of thrust .t0 (1,1) Average thrust
xDot (2,1) State derivative
function Riccati | ( | in | g | ) |
Solves the matrix Riccati equation.
Solves the matrix Riccati equation in the form g = [a r ] [q -a']
[sinf, rr] = Riccati( g )
g Input matrix
sinf Steady-state solution rr Repeated roots 1 = repeated roots
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, pp. 435-438.
function Ring | ( | in | rO, |
in | rI, | ||
in | l, | ||
in | w, | ||
in | n | ||
) |
Generate a ring with specified inner and outer wall, and length.
The origin is at the bottom. Type Ring for a demo.
[v, f] = Ring( rO, rI, l, w, n )
rO (1,1) Outer radius rI (1,1) Inner radius l (1,1) Length of middle section w (1,1) Front and back wedge length n (1,1) Number of divisions
v (:,3) Vertices f (:,3) Faces
function RootLocus | ( | in | g, |
in | k | ||
) |
function RootSort | ( | in | r | ) |
function RotMat | ( | in | angle, |
in | axis | ||
) |
Generates a rotation matrix that transforms in the opposite direction.
of the rotation. Angle may be one to three. Axis gives the order of transformation. For example: axis = [1;2;3] then b = b(3)*b(2)*b(1) and v = b*v unrotated rotated If angle has more than one column, then b will be [b1, b2, b3, ..., bn] and each row of bK will give the column indices of the corresponding transformation matrix. For example, to get the 3rd transformation matrix type b(:,bK(3,:))
[b, bK] = RotMat( angle, axis )
angle (:,n) Angle (rad) axis (:,n) Axis of rotation
b (3,n) Transformation matrix bK (3,n) Indexes to n
function RouthArray | ( | in | p | ) |
Computes the Routhian array for a polynomial.
Type RouthArray for a demo.
r = RouthArray( p )
p (1,n) Polynomial
r (n,:) Routh array
Reference: http://classes.engr.arizona.edu/ame558/public_html /topic1/page2.html
function RPhiTheta2Cart | ( | in | r | ) |
Computes the transformation matrix from an r, phi, theta frame.
to a standard cartesian frame. In an RPT frame, r is the radial direction, phi is 'east', and theta is in the direction of co-elevation. When theta is zero the r vector is in the xy-plane.
cRPT2Cart = RPhiTheta2Cart(r)
position (3,1) Position in cartesian coordinates.
cRPT2Cart (3,3) The transformation matrix
function RTSS | ( | in | mP, |
in | pP, | ||
in | m, | ||
in | p, | ||
in | a | ||
) |
Rauch-Tung-Striebel smoothing.
This assumes a discrete model of the form:
x[k] = a[k-1]x[k-1] + b[k-1]u[k-1] y[k] = h[k]x[k]
You pass all of the filter matrices that were already generated by a Kalman Filter.
Type RTSS for a demo of a double integrator system.
[mS, pS] = RTSS( mP, pP, m, p, a )
mP (n,:) Mean vector from KF prediction step pP (n,n,:) Covariance matrices from KF prediction step m (n,:) Mean vector from KF p (n,n,:) Covariance matrices from KF a (n,n,:) State transition matrices
mS (n,1) Smoothed mean vector pS (n,n) Smoothed covariance matrix
function S2Damp | ( | in | s | ) |
Eigenvalues to damping and natural frequency.
function S2Z | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | dT, | ||
in | sType | ||
) |
Transform an s-plane transfer function into the z-plane.
If only 3 inputs are given it assumes the input is in transfer function form. Otherwise it assumes state equation from
[numz, denz, k] = S2Z( nums, dens, dT, sType ) [f, g, h, j] = S2Z( a, b, c, d, dT, sType )
a State transition matrix or Numerator polynominal b Input matrix or dens c Output matrix or T d Feedthrough matrix T Sampling period sType 'bilinear', 'zoh', 'forward', 'backward'
f Discrete state matrix or numerator polynomial g Discrete input matrix or denominator polynomial h Output matrix or gain j Feedthrough matrix
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, p. 137-147.
function Sa2Q | ( | in | av | ) |
function SaveMovie | ( | in | m, |
in | fileName | ||
) |
Save a MATLAB movie.
.avi will be appended to the file name.
Changing the figure window size while recording will cause this function to fail.
Type SaveMovie for a demo creating and saving a movie of a SCARA robot.
SaveMovie( m, fileName )
m (1,1) Movie file fileName (1,:) File name
None
function SaveStructure | ( | in | gXXXX, |
in | fileName | ||
) |
function SectorPatch | ( | in | r0, |
in | u1, | ||
in | u2, | ||
in | scale | ||
) |
Compute faces and vertices for a sector patch.
The sector origin is at the point r0. One edge of the sector is pointed along the unit vector u1. The other edge is along the unit vector u2. The sector patch is computed as a set of triangles with length "scale" that bridge the two vectors.
Type SectorPatch for a demo.
[f,v] = SectorPatch( r0, u1, u2, scale )
r0 (3,1) Origin of sector u1 (3,1) Unit vector for one edge u2 (3,1) Unit vector for other edge scale (1,1) Scale defines length (radius) of sector
f (:,3) Faces v (:,3) Vertices
function SecToString | ( | in | s | ) |
function Selection | ( | in | list, |
in | msg, | ||
in | name | ||
) |
Selection GUI.
[k,item] = Selection( list );
list {:} Cell array of strings to choose from msg (:) Message to display in GUI (string) name {:} Name in title bar of GUI (string)
k (1) Index of chosen item item (:) Chosen item
Copyright (c) 2004 Princeton Satellite Systems, Inc. All rights reserved.
function SelectS | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | kS, | ||
in | kO, | ||
in | kI | ||
) |
Extract selected states from a state space model.
[a, b, c, d] = SelectS( a, b, c, d, kS, kO, kI )
a Plant matrix b Input matrix c Output matrix d Feedthrough matrix kS Selected states kO Selected outputs kI Selected inputs
a Plant matrix b Input matrix c Output matrix d Feedthrough matrix
function Series | ( | in | a1, |
in | b1, | ||
in | c1, | ||
in | d1, | ||
in | a2, | ||
in | b2, | ||
in | c2, | ||
in | d2 | ||
) |
Series connects two state space models.
Series connects two state space models so that y2 is the output and u1 is the input. u1 ----> P1 -----> P2 -----> y2 Since version 1.
[a, b, c, d] = Series( a1, b1, c1, d1, a2, b2, c2, d2 )
a1 Plant matrix b1 Input matrix c1 Measurement matrix d1 Input feedthrough matrix a2 Plant matrix b2 Input matrix c2 Measurement matrix d2 Input feedthrough matrix
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix
References: Maciejowski, J. M., Multivariable Feedback Design, Addison-Wesley, Reading, MA, 1989, pp. 372-373.
function SetCopy | ( | in | k, |
in | w, | ||
in | h | ||
) |
function SetFont | ( | in | name, |
in | size, | ||
in | angle, | ||
in | style | ||
) |
Sets default fonts.
Sets the following properties:
SetFont( name, size, angle, style )
name Font name size Font size angle Font angle ('italic') 'normal' is the default. style Font style or weight ('bold')
none
function SetUIElement | ( | in | h, |
in | varargin | ||
) |
Set certain properties of UIElements.
'visible' 'on', 'off' 'enable' 'on', 'off' 'position' [x y width height]
If the style is not for a UIElement, it will automatically pass the arguments to uicontrol.
SetUIElement( h, varargin )
h (:) Handle varargin {:} Property pairs
none
function SFunc | ( | in | t, |
in | x, | ||
in | u, | ||
in | flag | ||
) |
An example s-function that interfaces mfiles to Simulink.
It implements the function
dx/dt = f( t, x, u );
This is a simple simulation of an orbit. To customize this function you need to:
Edit ModelInitializeSizes to set up the model state, input and output
dimensions
[sys, x0, str, ts] = SFunc( t, x, u, flag )
t Time x State u Inputs flag Simulink control flag
ssys, x0, str, ts Required Simulink outputs
function ShapedStrut | ( | in | x1, |
in | x2, | ||
in | c | ||
) |
Generate strut going from x1 to x2.
Set the origin at the center of the crossection otherwise the ends may not look correct. Type ShapedStrut for a demo.
[v, f, volume] = ShapedStrut( x1, x2, c )
x1 (3,1) Location of top x2 (3,1) Location of bottom c (1,1) Crossection data .x (1,m) x locations .y (1,m) y locations
v (:,3) Vertices f (:,3) Faces volume (1,1) Volume of the strut
See also Polygon and Extrude.
function ShapeFlt | ( | in | wN, |
in | width, | ||
in | depth, | ||
in | wL, | ||
in | tSamp, | ||
in | sType | ||
) |
Generates a shaping filter with notches and first order roll off.
If no outputs are specified it will generate a Bode plot of the continuous system. The widths of the notches should be proportional to the center frequency. For example wN = 0.01 and width = 0.001 will look the same as wN = 0.001 and width = 0.0001.
[a, b, c, d] = ShapeFlt( wN, width, depth, wL, tSamp, sType )
wN (m) Center of notch (rad/sec) width (m) Width of notch (rad/sec) depth (m) Filter depth (dB) wL (1,1) Low pass cutoff (rad/sec) tSamp (1,1) Sampling period (sec) sType (1,1) State equation type ('Delta' or 'Z')
a (n,n) State matrix b (n,1) Input matrix c (1,n) Output matrix d (1,1) Feedthrough matrix
function ShowThreeImages | ( | in | x, |
in | y, | ||
in | z, | ||
in | title | ||
) |
Display three images.
If x, y or z are 2 dimensional ColorMapGrayScale is used for the color mapping.
Type ShowThreeImages for a demo
[h,hX,hY,hZ,s] = ShowThreeImages( x, y, z, title )
x (n,m,3 or 1) uint8 (0 - 255) or double (0 - 1) RGB image 1 y (n,m,3 or 1) uint8 (0 - 255) or double (0 - 1) RGB image 2 z (n,m,3 or 1) uint8 (0 - 255) or double (0 - 1) RGB image 3
h (1,1) Figure handle hX (1,1) X figure axes handle hY (1,1) Y figure axes handle hZ (1,1) X figure axes handle s (1,1) Image scaling
See also image, ColorMapGrayScale
function SigmaPointsChol | ( | in | d, |
in | p, | ||
in | varargin | ||
) |
UKF sigma points using chol.
See UKFWeight for definitions of alpha and kappa
d = SigmaPointsChol( d, p )
d (.) Data structure .cSqrt (1,1) sqrt(alpha^2*(length(x) + kappa)) .dX (1,1) Number of states .x (:,1) Current state p (n,n) Covariance matrix
d (.) Data structure .xA (:,:) Sigma points
Reference: Simo Sarkka, "Bayesian Estimation of Time-Varying Systems: Discrete-Time Systems, Version 1.3 (March 2, 2012).
function SimpAtm | ( | in | altitude, |
in | units | ||
) |
Simplified atmosphere model.
Agrees with the standard atmosphere model but is faster. Type SimpAtm for a demo.
d = SimpAtm( altitude, units )
altitude (:) Altitude (m or ft) units (1,:) 'si' or 'eng' i.e. m & kg or lb & ft
d (.) Standard atmosphere .temperature .pressure .density .speedOfSound .kinematicViscosity
function SimulatePlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create a Simulate GUI plug in used by DetectionFilterBuilder.
x = SimulatePlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function SISOListPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create a list of SISO elements for use by control design tools.
Allows the user to input parameters.
Typing SISOListPlugIn is the same as SISOListPlugIn('initalize')
x = SISOListPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function SISOPlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create an SISO GUI plug in.
h.block .g (1,1) Complete block model of class statespace .gBase (1,1) Base model (cannot be separated into SISO elements) .sISO (:) .g (:) Controller statespace representation .type {:} Controller type .m {:} Controller parameters .connection (1,1) 'base input', 'base output', 'parallel' .inputs {:} Inputs .outputs {:} Outputs
Typing SISOPlugIn is the same as SISOPlugIn('initialize')
x = SISOPlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if initialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function SizeAB | ( | in | a, |
in | b | ||
) |
function SizeABCD | ( | in | a, |
in | b, | ||
in | c, | ||
in | d | ||
) |
function SizeAC | ( | in | a, |
in | c | ||
) |
function SliderBar | ( | in | valMin, |
in | valMax, | ||
in | val0, | ||
in | callback, | ||
in | name, | ||
in | position, | ||
in | fig | ||
) |
Create a slider in a new figure with continuous calls to callback.
Can optionally put the slider into an existing figure. Type SliderBar for a demo.
SliderBar( valMin, valMax, val0, callback, name, position, fig )
valMin (1,1) Minimum value for slider bar valMax (1,1) Maximum value for slider bar val0 (1,1) Initial value of slider callback Callback function, 1 var. Example: @(x) disp(sin(x)) name (1,:) String name for figure (optional) position (1,4) Position information. * If a new figure is created, this input defines the position of the new figure in pixels on the screen. OR... * If an existing figure is specified, this input defines the position of the slider within the given figure window. fig (1,1) Figure handle. Optional. Supply this input to put the slider inside this figure, rather than creating a new figure.
u (1,1) Handle to the slider object.
References set().
function SortColumnCell | ( | in | x | ) |
function SortFigs | ( | in | h, |
in | xo | ||
) |
function Sph2Cart | ( | in | r, |
in | theta, | ||
in | phi | ||
) |
function Splash | ( | ) |
function SRiccati | ( | in | g | ) |
Solves the matrix Riccati equation.
The equation is in the form: g = [a -brb' ] [-q -a' ]
sinf = SRiccati( g )
g Input matrix
sinf Steady-state solution
References: Laub, A.J. (1979). A Schur Method for Solving Algebraic Riccati Equations. IEEE Transactions on Automatic Control, AC-24(6), 913-921.
function SS2ND | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | iu | ||
) |
Converts from state space to numerator denominator form.
Creates a transfer function model of a state-space system from one input channel to all of the output channels using the relationship det(sI-A+bc) - (1-d)det(sI-A) c*inv(sI-A)*b + d = ----------------------------- det(sI-A) where c is a row vector and b a column vector.
[num, den] = SS2ND( a, b, c, d, iu )
a Plant matrix b Input column vector c Output row vector d Feedthrough element iu Input channel
num Numerator polynomial(s) one output per row den Denominator polynomial
References: Kalaith, T., Linear System, Prentice-Hall, Englewood-Cliffs, NJ, 1980.
function SSEmpty | ( | ) |
function SSFromNonlinear | ( | in | f, |
in | x, | ||
in | t, | ||
in | u, | ||
in | kUse, | ||
in | varargin | ||
) |
Computes state space matrices from a nonlinear function.
This function computes state space matrices from f(x,t,u,varargin). The RHS must be of the form f(x,t,u,varargin).
[a, b] = SSFromNonlinear( f, x, t, u, k, varargin )
f (1,:) Dynamical function name x (n,1) Nominal state t (1,1) Time u (m,1) Nominal control kUse (1,:) States to use varargin Arguments passed to f
a (n,n) State matrix b (n,m) Input matrix
function Staircase | ( | in | t, |
in | dT, | ||
in | varargin | ||
) |
Generates steps for any number of inputs.
Since version 10.
For example: t = [0 10 100]; v = [0 20 30]; h = [10 4 33];
[tS,vS,hS] = Staircase(t,0.1,v,h)
[tS, varargout] = Staircase( t, dT, varargin )
t (1,:) Transition times dT (1,1) Time step varargin {:} Any number of input variables
tS (1,p) Times for each step varargout {:} Ramps corresponding to varargin's m (1,:) Mass of tank v (1,:) Volume
function StateDisplay | ( | in | action, |
in | varargin | ||
) |
Draw a 3D covariance display in real-time.
Type StateDisplay for a demo.
tag = StateDisplay( action, varargin )
action (3,:) Action 'initialize' or 'update' when 'update' state (:,:) New state when 'initialize' k (2,:) Elements of p to display e (3,1) Errors state (3,:) Initial state position (1,4) Position hFig (1,1) Figure handle
tag (1,1) Handle to the display
function StatePrp | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | x, | ||
in | u, | ||
in | sType | ||
) |
function StateSpacePlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create an StateSpace GUI plug in used by DetectionFilterBuilder.
x = StateSpacePlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function StdAtm | ( | in | altitude, |
in | AtmData, | ||
in | units | ||
) |
Computes atmospheric density based on the standard atmosphere model.
To get a table of standard atmosphere data type
load -ascii AtmData;
Type StdAtm for demo.
d = StdAtm( altitude, AtmData, units )
altitude (:) Altitude (m or ft) AtmData (:,6) Standard atmosphere data. units (1,:) 'si', 'mks' or 'eng' i.e. m & kg or lb & ft
d (.) Standard atmosphere struct .temperature .pressure .density .speedOfSound .kinematicViscosity
x is [altitude (m) temperature (deg-K) pressure (N/m^2) density (kg/m^3)
speed of sound (m/s) kinematic viscosity (m^2/s)] or
[altitude (ft) temperature (deg-R) pressure (lbf/ft^2) density (lbf/m^3) speed of sound (ft/s) kinematic viscosity (ft^2/s)]
function SteadyS | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | y, | ||
in | q, | ||
in | r | ||
) |
Determine the steady state control for a state space system.
. x = Ax + Bu y = Cx + Du given y. If the number of inputs is less than the number of outputs it computes a weighted least squares fit to y using the weighting matrix q. If the number of inputs is greater than the number of outputs it minimizes the function u'ru. If q is not input it uses the identity matrix.
[u, x, yC] = SteadyS( a, b, c, d, y, q, r )
a Plant matrix b Input matrix c Output matrix d Feedthrough matrix y Desired output q Weighting matrix for y r Weighting matrix for u
u Steady state control x Steady state state yC Achievable y if number of outputs > number of controls
Reference: Bryson, A.E., Jr. (1994). Control of Spacecraft and Aircraft Princeton University Press, Princeton, NJ.
function Step | ( | in | g, |
in | iU, | ||
in | dT, | ||
in | nSim, | ||
in | inputType, | ||
in | statesFlag | ||
) |
Generate a step response of a state space system.
If no outputs are given it will plot.
[y,x,t] = Step( g, iU, dT, nSim, inputType, statesFlag )
g State space system of type statespace iU (n) Input* optional, defaults to all dT (1) Time step* nSim (1) Number of steps* inputType (:) 'step', 'impulse', 'white noise'* optional, defaults to a step response. statesFlag (1) Flag for plotting the states, optional.
y (p,m) Step response x (n,m) States t (1,m) Time vector
function STKAtt | ( | in | fileName, |
in | ver, | ||
in | epoch, | ||
in | nPoints, | ||
in | time, | ||
in | attitude, | ||
in | type, | ||
in | seq | ||
) |
Prints attitude data to STK-formatted file.
[err, message] = STKAtt(fileName,ver,epoch,nPoints,time,attitude,type,seq)
fileName Filename for output. Will be overwritten if it already exists. ver STK version number (string!) epoch Beginning date and time: [Y M D H M S] nPoints Number of attitude data points time Time in seconds for each data point attitude Attitude data describing the rotation from ECI J2000 to body, see input 'type' for allowable types type 'quaternion','Euler','YPR','ECIVector',or 'ECFVector' seq Rotation sequence for Euler or yaw-pitch- roll angles, ex. [1 2 3]
err err ~= 0 means an error occurred message Error message
function STKOrbit | ( | in | fileName, |
in | ver, | ||
in | epoch, | ||
in | nPoints, | ||
in | time, | ||
in | position, | ||
in | velocity, | ||
in | type | ||
) |
Prints orbit data to STK-formatted file.
[err, message] = STKOrbit( fileName, ver, epoch, nPoints, time, position, velocity, type )
fileName Filename for output. Will be overwritten if it already exists. ver STK version number (string!) epoch Beginning date and time: [Y M D H M S] nPoints Number of orbit data points time Time in seconds for each data point position Position data in km (if type = ECF or ECI) or in [degrees,degrees,km] (if type = LLR) velocity Velocity data in km/sec (if type = ECF or ECI) or [degrees,degrees,km]/sec (if type = LLR) type 'ECI','ECF',or 'LLR'
err err ~= 0 means an error occurred message Error message
function StopGUI | ( | in | name | ) |
function StringMatch | ( | in | s, |
in | sA, | ||
in | ignoredArg | ||
) |
Finds which elements of sA match s.
Uses strcmp and strcmpi internally. An alternative to strmatch which is no longer recommended by MathWorks.
Type StringMatch for a demo
k = StringMatch(s,sA,~)
s (1,:) String sA {:} Cell array of strings nC (1,1) If entered, ignore case
k (1,:) Elements of sA that match s
function StringToToken | ( | in | s | ) |
function StringToTokens | ( | in | s, |
in | delimiters, | ||
in | noSpace | ||
) |
function StrMtch | ( | in | s, |
in | sM | ||
) |
function StructToCell2D | ( | in | x | ) |
Convert a structure into a cell array.
Where columns of the array include both values and fieldnames. For example, the struct x.a = 1 x.b.c = 2; x.b.d = 3; Becomes a 1 b c 2 b d 3 The companion array m is 1 0 1 1 1 0 1 1 0 Where a 1 indicates that the cell is a field name. This function contains a recursive call. Therefore the depth of the structure must be less than the number of recursions. The struct may have one dimensional cells as elements.
[y, m] = StructToCell2D( x )
x (1,1) Structure
y (:) Cell Array m (:) Index matrix 1 = field, 0 = data
function StructToText | ( | in | data, |
in | textFileName | ||
) |
Write data structure to a text file or command line display.
The fields will be printed in order with the space-separated data starting on the next line, as in:
mass: 1.0
Matrices are prepended with the size in rows and columns.
az (1,8): 0 0.785398 1.5708 2.35619 3.14159 3.92699 4.71239 5.49779
Small column vectors will be displayed as a transpose to save vertical space. This function gracefully displays function handles, cell arrays, strings, and matrices. For all other object types, disp is called.
Passing in a 1 for textFileName will print the text to the command line, and this is the default behavior if no file name or fid is entered.
StructToText( data, textFileName ) StructToText( data, fid )
data (.) Data structure textFileName (:) Name of text file to write to, or fid
none
function StructureList | ( | in | action, |
in | modifier, | ||
in | d, | ||
in | name, | ||
in | position, | ||
in | hFig | ||
) |
Creates a list of structures and variables.
d may contain data structures or any type of variable in its cell array. On initialization it returns the handle to the list. Also 'modifier' is a call back string that StructureList should call when an element in the list is selected. When an element in a list is selected an array is created with pointers to the element and to all structures to which it is attached. This can be used to identify the element in a structure.
s = StructureList( action, modifier, d, name, position, hFig )
action (1,:) Action to be taken modifier (1,:) Modifier to the action d {} Cell array of data structures name {} Cell array of data structure name position (1,4) Position of the frame hFig (1,1) Handle to the figure
hL (1,:) Handle to the selected field tag (1,:) StructureList tag
function Strut | ( | in | x1, |
in | x2, | ||
in | r1, | ||
in | r2, | ||
in | n | ||
) |
Generate a variable radius strut going from x1 to x2.
If r2 is omitted, r2 = r1. If n is omitted n = 10.
Type Strut for a demo.
[v, f, vol] = Strut( x1, x2, r1, r2, n )
x1 (3,1) Location of top x2 (3,1) Location of bottom r1 (1,1) Radius at top r2 (1,1) Radius at bottom, optional n (1,1) Number of circumferential divisions (default is 10)
v (:,3) Vertices f (:,3) Faces vol (1,1) Volume
See also: Frustrum
function SVPlot | ( | in | g, |
in | w | ||
) |
function Symmetrize | ( | in | p | ) |
Makes a square matrix symmetric by adding its transpose and dividing.
by two.
Type Symmetrize for a demo
This is often used to fix matrices that are slightly asymmetric due to numerical errors. This is particularly useful with Kalman filters for maintaining a symmetric covariance matrix.
p = Symmetrize( p )
p (n,n) Matrix
p (n,n) Symmetric matrix
function SystemTime | ( | in | action, |
in | mET, | ||
in | jD | ||
) |
function T2JD | ( | in | T | ) |
function TabBox | ( | in | action, |
in | modifier, | ||
in | tabs, | ||
in | content, | ||
in | position, | ||
in | hFig, | ||
in | formatInfo, | ||
in | data, | ||
in | callback | ||
) |
Create a tab box from plug-ins.
[x, y, tag] = TabBox( action, modifier, tabs, content, position, hFig, formatInfo, data, callback) modifier is passed to the content functions as their action units are defined externally. When a contents function is called action is used as the function name and modifier as the action.
action (1,:) Action to be taken modifier (1,:) Modifier to the action tabs {n} Cell array with tab labels content {n} Cell array with function names that define the content position (1,4) [left,bottom,width,height] content region only! hFig (1,1) Figure handle formatInfo (1,1) Data structure with format information .FontAngle (1,:) .FontName (1,:) .FontSize (1,1) .FontUnits (1,1) .FontWeight (1,:) .ForegroundColor (1,3) data {} Initialization data callback (1,:) CreateCallback function when a control in a panel is hit
x {} Tags for panels y {} Handles to tab buttons tag {} Tag for the frame around the tab box. Userdata of this frame provides access to all of the parts of the tab box
function TAI2TT | ( | in | tAI | ) |
function TDB2TT | ( | in | tDB, |
in | jD | ||
) |
Converts barycentric dynamical time.
Used as time-scale of ephemerides referred to the barycentre of the solar system to terrestrial dynamic time.
tT = TDB2TT( tDB, jD )
tDB (:,:) Terrestrial dynamic barycenter time jD (:,:) Julian date (days)
tT (:,:) Terrestrial (dynamic) time
References: The Astronomical Almanac for the Year 1993, U.S. Government Printing Office,1993, p. B5.
function Telemetry | ( | in | action, |
in | modifier, | ||
in | u, | ||
in | v | ||
) |
Generates a GUI with a set of telemetry pages.
To initialize: Telemetry( 'initialize', d, onlineHelpFileName, tagForTelemetryGUI ) The structure array d. d has the form d.telemetryNames{:} d.units{:} d.format{:} C format strings d.page(:) where page(k).name page(k).columns page(k).telemetryPoint(:) A row by row list of points corresponding to the names or a mat file name with the above information or if no input it will ask for a mat file of the correct form. See TelemetryDemo. To update the pages, type Telemetry( 'update', tag, u ) where u is the data corresponding to d.telemetryNames. u has three fields u.data u.time u.timeFormat 'Calendar' 'sec', 'JD' You must input Julian Date for JD or calendar. Calendar time format is a string 'mm/dd/yyyy hh:mm:ss' To increase internal memory allocation search for nTelemetryPoints and set to a larger number. To quit type Telemetry( 'quit', tag );
tag = Telemetry( action, modifier, u, v )
action (1,:) Action to be taken by the message center modifier (:) Modifier to the message u (:) Help file name v (:) Data structure or name of the telemetry data file
tag (1,:) Returns the window tag on initialization
function TelemetryOffline | ( | in | action, |
in | modifier | ||
) |
function TelemetryPlot | ( | in | action, |
in | modifier, | ||
in | u | ||
) |
Plot real time data in a single window.
tag = TelemetryPlot( action, modifier, u )
action (1,:) Action modifier (:) On initialization this is the struture .tLabel .tLim (1,2) [start stop] .yLim (:,2) [min max] if equal RealTimePlot will use [-1 1] .yLabel {:} Cell array with y labels .t (1,1) Initial time .y (1,1) Initial state vector u (:) .data {:} Data .t (1,1) Time
tag (1,1) Tag to the plot page
function TextInBox | ( | in | pos, |
in | s, | ||
in | varargin | ||
) |
function TextS | ( | in | x, |
in | y, | ||
in | s, | ||
in | k | ||
) |
function TimeCntrl | ( | in | action | ) |
Perform actions specified by the time display.
This routine is called by a callback routine in TimeGUI.m. You do not normally call it yourself.
Initialize the global as follows:
global simulationAction simulationAction = ' ';
Use the following code in your simulation loop:
switch simulationAction case 'pause' pause simulationAction = ' '; case 'stop' return; case 'plot' break; end
TimeCntrl( action )
action (1,:) Action to take
None
function TimeDisplay | ( | in | action, |
in | varargin | ||
) |
Displays an estimate of time to go.
Call TimeDisplay('update') each step; the step counter is incremented automatically. This GUI does NOT provide any simulation controls (pause/stop). Updates at 0.5 sec intervals.
TimeDisplay( 'initialize', nameOfGUI, totalSteps ) TimeDisplay( 'update' ) TimeDisplay( 'close' )
You can only have one TimeDisplay operating at once.
TimeDisplay( action, varargin )
action (1,:) 'initialize' 'update' 'close' nameOfGUI (1,:) Name to display totalSteps (1,1) Total number of steps
None
function TimeGUI | ( | in | totalSteps, |
in | stepsDone, | ||
in | tToGoMem, | ||
in | rRT, | ||
in | dT, | ||
in | name | ||
) |
A GUI displaying the time remaining and estimated completion time.
Useful for simulations and other slow tasks. Computes the time left to go in the simulation, the predicted finish time and the ratio of simulation time to real time. This routine should be called at regular intervals. It will update the GUI no faster then 5 times a second to prevent the graphics from slowing down the simulation.
Type TimeGUI( 'close' ) to close the GUI.
See also TimeGUIDemo.
[ rRT, tToGoMem, tToGo, tDone ] = TimeGUI( totalSteps, stepsDone,... tToGoMem, rRT, dT, name )
totalSteps Total number of steps in the simulation stepsDone Number of steps completed tToGoMem Memory [lastJD, lastStepsDone, number of averages done] rRT Ratio of simulation time to real time dT Simulation time step (sec) name Name of simulation
rRT Ratio of simulation time to real time tToGoMem Memory [lastJD, lastStepsDone, number of averages done] tToGo Time left in the simulation tDone Predicted clock time of finish
function TimeHistory | ( | in | t, |
in | y, | ||
in | yL, | ||
in | figTitle, | ||
in | yList, | ||
in | leg | ||
) |
Time history plots.
Creates a set of plots, one for each row of yL. t is assumed to be in seconds. It will automatically scale time units. If yList is entered you can have multiple plots per axis. yList must be the same size as yL leg adds legends. It must be in the for {{} {}} where there is one cell array per plot.
Type TimeHistory for a demo.
[hFig,hL] = TimeHistory( t, y, yL, figTitle, yList, leg )
t (1,:) Time (s) y (n,:) Y values yL {m,1} Y-axis labels figTitle (1,:) Figure title yList {m,1} Plots per figure leg {m,1} Legend
hFig (1,1) Figure handle hL (:,1) Line handles
See also Plot2D, TimeLabl
function TimeLabel | ( | in | t0 | ) |
Produce time labels and scaled time vectors.
Generates a time series from a time series in seconds with more reasonable units: minutes, hours, days, or years.
[t, u, s, f] = TimeLabel( t0 )
t0 (1,:) Time series (s)
t (1,:) Time series (new units) u (1,:) Label string, 'Time = (units)' s (1,:) Units string f (1,:) Time scale factor, t = t0/f
function TimeLabl | ( | in | t0, |
in | dT | ||
) |
Generates a time label given the maximum value of t and rescales t.
If two arguments are entered it computes the time series t as
t = (0:(nSim-1))*dT
The available units are (years,months,weeks,days,hours,minutes,seconds) Years and months are mean.
[t, c, u, s] = TimeLabl( t0 ) [t, c, u, s] = TimeLabl( nSim, dT )
t0 (1,:) Time (sec)
nSim (1,1) Number of time steps dT (1,1) Time step (sec)
t (1,:) Time (new units) c (1,:) Label string, 'Time = (units)' u (1,:) Units of time s (1,1) Time scale factor, t = t0/s
function TimePlugIn | ( | in | action, |
in | modifier, | ||
in | hFig, | ||
in | position, | ||
in | callback | ||
) |
Create a time GUI plug in.
To set the time plugin: TimePlugIn( 'set', h.timePlugInTag, struct( 'jDEpoch', 2.45162380976e+06, 'duration', '01:00:00', 'dT', 0.25 ) ); Typing TimePlugIn is the same as TimePlugIn('initialize')
x = TimePlugIn( action, modifier, hFig, position, callback )
action (1,:) Action 'initialize', 'update' modifer (1,:) Modifier to the action or data structure if intialization hFig (1,1) Handle to the figure or if 'update' radio button handles position (1,4) [left bottom width height] callback (1,:) Callback string when something has changed in this gui
x (1,1) The tag if action is 'initialize'
function TimeStringToJD | ( | in | s | ) |
function TimeToGo | ( | in | totalSteps, |
in | stepsDone, | ||
in | tToGoMem, | ||
in | rRT, | ||
in | dT | ||
) |
Computes the time left to go in the simulation, the predicted finish.
time and the ratio of simulation time to real time. This routine should be called at regular intervals.
[ rRT, tToGoMem, tToGo, tDone ] = TimeToGo( totalSteps, stepsDone, tToGoMem, rRT, dT )
totalSteps Total number of steps in the simulation stepsDone Number of steps completed tToGoMem Memory [lastJD, lastStepsDone, number of averages done] rRT Ratio of simulation time to real time dT Simulation time step (sec)
rRT Ratio of simulation time to real time tToGoMem Memory [lastJD, lastStepsDone, number of averages done] tToGo Time left in the simulation tDone Predicted clock time of finish
function TitleS | ( | in | x, |
in | font | ||
) |
function Torus | ( | in | c, |
in | r, | ||
in | n, | ||
in | c2, | ||
in | nuX | ||
) |
function TranslateAxes | ( | in | i, |
in | r, | ||
in | m, | ||
in | sgn | ||
) |
Recompute the moment of inertia "i" by translating axes.
There are two cases: - translating the origin by "r", body has mass "m" - adding a point mass "m" at location "r" from the origin
i = TranslateAxes( i, r, m, sgn )
i (3,3) Original Moment of Inertia r (3,1) Translation vector m (1) Mass of body sgn (1) Sign of inertia change. +1 Positive if point mass added or if origin moved away from CG -1 Negative if origin moved towards CG
i (3,3) New Moment of Inertia
function TreeDiagram | ( | in | n, |
in | w, | ||
in | update, | ||
in | withTrackIDs | ||
) |
Generates a tree diagram.
Type TreeDiagram for a demo. w is optional the defaults are:
.name = 'Tree'; .width = 400; .fontName = 'Times'; .fontSize = 10; .linewidth = 1; .linecolor = 'r';
TreeDiagram( n, w, update, withTrackIDs )
n {:} Nodes .parent (1,1) Parent .name (1,1) Number of observation .scan (1,1) Scan number w (1,1) Diagram data structure .name (1,:) Tree name .width (1,1) Circle width .fontName (1,:) Font name .fontSize (1,1) Font size update (1,1) If entered update an existing plot
None
function TResp | ( | in | g, |
in | x0, | ||
in | u, | ||
in | dT, | ||
in | T | ||
) |
Compute the time response of a state-space system.
Type TResp for a demo.
[x,y,t,u] = TResp( g, x0, u, dT, T );
g (.) Statespace object x0 (nS,1) Initial state u (nI,:) Input control vector dT (1,1) Time step [sec] T (1,1) Final time [sec] (optional)
x (nS,:) State trajectory y (nO,:) Output trajectory t (1,:) Time history [sec] u (nI,:) Input control vector
function Triangle | ( | in | x, |
in | y, | ||
in | z, | ||
in | mass | ||
) |
Generate a solid triangle.
This function will compute the mass properties data structure if a mass is entered. Type Triangle for a demo.
[v, f, m] = Triangle( x, y, z, mass )
x (1,1) x length y (1,1) y length z (1,1) z length mass (1,1) mass
v (:,3) Vertices f (:,3) Faces m (.) Mass data structure
See also Volumes, Inertias, DrawVertices
function TriangularTruss | ( | in | x1, |
in | x2, | ||
in | d, | ||
in | n | ||
) |
Generate a triangular truss going from x1 to x2.
The truss is inscribed in a circle of radius d. If n is omitted n = 10.
Type TriangularTruss for a demo.
[v, f, l] = TriangularTruss( x1, x2, ds, n )
x1 (3,1) Location of top x2 (3,1) Location of bottom d (1,1) Diameter n (1,1) Number of divisons
v (:,3) Vertices f (:,3) Faces l (1,1) Total length of the truss elements
function TrnsZero | ( | in | a, |
in | b, | ||
in | c, | ||
in | d | ||
) |
Computes the transmission zeros of a plant.
For continuous time systems.
z = TrnsZero( a, b, c, d )
a Plant matrix b Input matrix c Measurement matrix d Input feedthrough matrix
z Transmission zeros
References: Maciejowski, J.M., Multivariable Feedback Design, Addison-Wesley, 1989, pp. 386-389.
function Truss | ( | in | x1, |
in | x2, | ||
in | w, | ||
in | n, | ||
in | wBar | ||
) |
Generate a square truss going from x1 to x2.
If n is omitted n = 10. wBar is optional and is the width of the struts. Note that 2D trusses will not work properly if exported as OBJ files.
Type Truss for a demo of a truss with 3D struts.
[v, f, l] = Truss( x1, x2, w, n, wBar )
x1 (3,1) Location of top x2 (3,1) Location of bottom w (1,1) Width n (1,1) Number of divisions wBar (1,1) Bar width
v (:,3) Vertices f (:,3) Faces l (1,1) Total length of the truss elements
function TT2TAI | ( | in | tT | ) |
function TT2TDB | ( | in | tT, |
in | jD | ||
) |
function TT2UT1 | ( | in | jDTT | ) |
function TTPlots | ( | in | mag, |
in | w, | ||
in | t, | ||
in | gU, | ||
in | title | ||
) |
function Tube | ( | in | rO, |
in | rI, | ||
in | l, | ||
in | n | ||
) |
function TubeArc | ( | in | rO, |
in | rI, | ||
in | l, | ||
in | arc, | ||
in | n | ||
) |
Generate a portion of a tube with an inner and outer wall.
The top and bottom radii may be different. The origin is at the bottom. This function will not work correctly for a full tube. Use Tube for that purpose.
Type TubeArc for a demo.
[v, f] = TubeArc( rO, rI, l, n )
rO (1,2) Outer radius [top, bottom] rI (1,2) Inner radius [top, bottom] l (1,1) Length arc (1,2) Arc [beginning end] (rad) n (1,1) Number of divisions
v (:,3) Vertices f (:,3) Faces
function TubeSection | ( | in | rO, |
in | rI, | ||
in | l, | ||
in | ang1, | ||
in | ang2, | ||
in | n | ||
) |
Generate a tube with specified inner and outer wall, and length.
The origin is at the bottom. Type Tube for a demo.
[v, f] = TubeSection( rO, rI, l, ang1,ang2, n )
rO (1,1) Outer radius rI (1,1) Inner radius l (1,1) Length ang1 (1,1) Start angle ang2 (1,1) End angle n (1,1) Number of divisions
v (:,3) Vertices f (:,3) Faces
function TubeWithBends | ( | in | r, |
in | p, | ||
in | nB, | ||
in | nC | ||
) |
Generate a tube with bends.
If nB is zero it will not smooth the bends.
Type TubeWithBends for a demo.
[v, f] = TubeWithBends( r, p, nB, nC )
r (1,1) Radius of the tube p (3,:) Location of center points nB (1,1) Number of divisions at bends (should be odd) nC (1,1) Number of circumferential divisions
v (:,3) Vertices f (:,3) Faces
function Tubing | ( | in | p, |
in | d, | ||
in | n | ||
) |
Generate a tube through the points p.
If n is omitted n = 3. Type Tubing for a demo.
[v, f, l] = Tubing( p, d, n )
p (3,:) Points through which the tube must pass d (1,1) Diameter n (1,1) Number of divisons
v (:,3) Vertices f (:,3) Faces l (1,1) Total length of the tubing elements
function U2Q | ( | in | u, |
in | v | ||
) |
function UChannel | ( | in | x, |
in | y, | ||
in | z, | ||
in | t, | ||
in | d, | ||
in | b | ||
) |
Generate a box with a u cut at the +x end.
Type UChannel for a demo. With no outputs UChannel will draw your object.
[v, f] = UChannel( x, y, z, t, d, b )
x (1,1) x length y (1,1) y length z (1,1) z length t (1,1) Flange thickness d (1,1) Depth of cut in x b (3,3) Transformation matrix (Default is eye(3))
v (16,3) Vertices f (12,3) Faces
function UDKalmanFilter | ( | in | action, |
in | d, | ||
in | z | ||
) |
Implements a Kalman filter using UD factorization.
First call
d = UDKalmanFilter( 'p to ud', p )
You need to add r, q, h, and x to d. Then call
loop:
d = UDKalmanFilter( 'incorporate measurement', d, z ) d = UDKalmanFilter( 'propagate', d ) end
d = UDKalmanFilter( action, d, z )
action (1,:) Action to perform d (1,1) Data structure .u Upper triangular portion of the covariance matrix .r Measurement noise scalar .q State noise matrix .h Measurement equation .x State .k Gain (computed) z (n,1) Measurement(s)
y (:) Depends on the action
References: Bierman, G. J. (1977) Factorization Methods for Discrete Sequential Estimation. Academic Press.
function UIElement | ( | in | varargin | ) |
Interface to PSS and Mathworks UI.
PSS functions
editpm Edit box with a + and - button list Two dimensional scrollable list of uicontrols checkboxlist List of checkboxes listwithbutton Listbox with a button. You need to supply two
callbacks, callback.button and callback.list datastructurelist Draw a datastructure
datastructurelist
h = UIElement( 'parent', h.fig, 'height', 60, 'position', p,...
'width', 180, 'style', 'datastructurelist', 'datastructure', d );
h = UIElement( varargin )
varargin {} Variable input arguments
h (:) Handle
function UKF | ( | in | action, |
in | d, | ||
in | y, | ||
in | verbose | ||
) |
Implement an Unscented Kalman Filter.
The filter uses numerical integration to propagate the state. The filter propagates sigma points, points computed from the state plus a function of the covariance matrix. For each state there are two sigma states.
The default integrator is RK4, or you cab specify an integrator with the field
d.integrator = @myIntegratorName
To initialize UKF call
d = UKF( 'initialize', d );
To update
d = UKF( 'update', d, y );
The filter appends internal data to the data structure. d.x gives the current estimated state and d.pXX the state covariance.
The measurement function is of the form
meas = MeasFun( x, dMeasFun );
The state function is of the form
xDot = StateFun( x, t, dStateFun );
You can use either the Cholesky transform or matrix square root to form the sigma points.
d = UKF( action, d, y ) d = UKF( 'datastructure', nStates, nMeas )
action (1,:) 'initialize' or 'update' or 'datastructure' d (.) UKF data structure .rHSFun (1,:) Name or handle of RHS function .integrator (1,:) Handle of integrator function .rHSFunData (.) RHS function data structure .measFun (1,:) Handle of measurement function .measFunData (.) Measurement function data .x (n,1) Initial state vector .p (n,n) Covariance matrix for x .pXX (n,n) Covariance after state update .dY (1,1) Number of measurements .dX (1,1) Number of states .rP (n,n) Process noise covariance .rM (n,n) Measurement noise covariance .alpha (1,1) Scaling 1e-4 <= alpha <= 1 .kappa (1,1) Secondary scaling usually 0 .beta (1,1) Prior knowledge of distribution = 2 for Gaussian distributed noise .dT (1,1) Time step .t (1,1) Time .sigmaPtAlg (1,1) 1 = sqrtm, 2 = chol y (m,1) Measurement vector verbose (1,1) Flag for verbose output. 1 = warn, 2 = error.
d (.) UKF data structure with the following appended .dX (1,1) Number of states .n (1,1) Number of sigma points .y (m,1) Measurements based on the states .xA {n} Sigma points .pP (n,n) Covariance matrix prior to measurement .xP (n,1) State vector prior to measurement incorporation .res (:,1) Residuals
References: Voss, H. U., Timmer, J., Kurths, J., "Nonlinear Dynamical System Identification from Uncertain and Indirect Measurements," International Journal of Bifurcation and Chaos, Vol. 14, No. 6, 2005, pp. 1905-1933. Van der Merwe, R. and Wan, E., "Sigma-Point Kalman Filters for Probabilistic Inference in Dynamic State-Space Models",
function UKFP | ( | in | action, |
in | d, | ||
in | y | ||
) |
Implement an Unscented Kalman Filter for parameter estimation.
The filter uses numerical integration to propagate the state. The filter propagates sigma points, points computed from the state plus a function of the covariance matrix. For each parameter there are two sigma parameters. The current estimated state must be input each step.
The filter appends internal data to the datastructure
To initialize call
d = UKFP( 'initialize', d );
To update
d = UKFP( 'update', d, y );
d = UKFP( action, d, y )
action (1,:) 'initialize' or 'update' d (.) UKFP data structure .rHSFun (1,:) Name of RHS function .rHSFunData (1,1) RHS function data structure .measFun (1,:) Name of measurement function .measFunData (1,1) Measurement function data .x (:,1) State vector .p (n,n) Covariance matrix for w .rP (n,n) Plant noise covariance .rY (m,m) Measurement noise covariance .alpha (1,1) Scaling parameter (1e-4 to 1) .beta (1,1) Scaling parameter (usually 2) .kappa (1,1) Scaling parameter (usually 0) .w (n,1) Parameters y (m,1) Measurement vector
d (.) UKFP data structure with the following appended .n (1,1) Twice the number of states + 1 .y (m,1) Measurements based on the states .wA {n} Sigma points .wC (1,n+1) Weights .wM (1,n+1) Weights .gamma (1,1) Sigma points scaling parameter .lambda (1,1) Sigma points scaling parameter .pDD (m,m) Measurement covariance .pWD (n,m) Parameter, measurement cross covariance .D (n,2*n) Measurements at sigma points .dY (n,1) Residuals .L (1,1) Number of parameters
References: Van der Merwe, R. and Wan, E., "Sigma-Point Kalman Filters for Probabilistic Inference in Dynamic State-Space Models". Matthew C. VanDyke, Jana L. Schwartz, Christopher D. Hall, "UNSCENTED KALMAN FILTERING FOR SPACECRAFT ATTITUDE STATE AND PARAMETER ESTIMATION,"AAS-04-115.
function UKFPredict | ( | in | d | ) |
Unscented Kalman Filter state prediction step.
This uses RK4 to propagate the state.
Use d = UKFWeight( d ) to get the weight matrices.
The function f is of the form f(x,t,d) where d is a data structure contained in fData.
d = UKFPredict( d )
d (1,1) UKF data structure .m (n,1) Mean .p (n,n) Covariance .q (n,n) State noise .wM (1,2n+1) Model weights .w (2n+1,2n+1) Weight matrix .f (1,:) Pointer for the right hand side function .fData (1,1) Data structure with data for f .dT (1,1) Time step .t (1,1) Time
d (1,1) UKF data structure .m (:,1) Mean .p (:,:) Covariance
function UKFRTSS | ( | in | m, |
in | p, | ||
in | d | ||
) |
Rauch-Tung-Striebel smoothing for an Unscented Kalman Filter.
This is for a non-augmented, i.e. additive Gaussian noise form. This assumes a model of the form:
x = f(x,q) y = h(x,r)
You pass the data structure that was already generated by an Unscented Kalman Filter and the results of the predict and update steps.
d = UKFRTSS( m, p, d )
m (n,:) Means p (n,n,:) Covariance d (1,1) UKF data structure .m (n,1) Mean .p (n,n) Covariance .q (n,n) State noise .wM (1,2n+1) Model weights .w (2n+1,2n+1) Weight matrix .f (1,:) Name of right hand side .fData (1,1) Data structure with data for f .dT (1,1) Time step .t (1,1) Time
d (1,1) UKF data structure .mS (:,1) Mean smoothed .pS (:,:) Covariance smoothed
function UKFUpdate | ( | in | d | ) |
Unscented Kalman Filter measurement update step.
The kMeas field is a list of measurement sets (i.e. measurement functions) to use.
d = UKFUpdate( d )
d (.) UKF data structure .m (:,1) Mean .p (:,:) Covariance .h {} Measurement function pointers .hData {} Measurement function data .kH (1,:) Which measurements are in y .r {} Measurement covariance matrices .y (1,1) Measurement data structure .data (m,1) Measurements .param (1,1) Parameter data structure .hFun (1,:) Measurement function pointer .hData (1,1) Measurement function data structure .r (m,m) Measurement covariance .w (:,:) Weighting matrix .wM (:,1) Weights .kMeas (1,:) Measurement sets to use.
d (1,1) UKF data structure .m (:,1) Mean .p (:,:) Covariance .v (m,1) Residuals
function UKFUT | ( | in | m, |
in | p, | ||
in | c, | ||
in | wM, | ||
in | w, | ||
in | fun, | ||
in | dFun | ||
) |
Unscented Kalman Filter transform.
This can be used for the measurements or the states. The weight matrix is used by the matrix form of the unscented transform.
The functions fun are passed as pointers and are of the form
MyFunction( x, d )
where x is an n by 2*n matrix of states or measurements. d is a data structure. If the unscented transform is used for states, fun propagates the states. For measurements it computes the measurements. The weighting factors are computed by UKFWeight.
[mU, sU, cU] = UKFUT( m, p, c, wM, w, fun, dFun )
m (n,1) Means p (n,n) Covariance matrix c (1,1) Scaling constant wM (1,2*n) Weighting array w (2*n+1,2*n+1) Weighting matrix fun (1,:) Function pointer for processing x dFun (1,1) Data structure to pass to fun
mU (2*n+1,2*n+1) State matrix sU (2*n+1,2*n+1) Correlation matrix cU (2*n+1,2*n+1) Cross-correlation matrix
function UKFWeight | ( | in | d | ) |
Unscented Kalman Filter weights.
The weight matrix is used by the matrix form of the Unscented Transform. Both UKSPredict and UKSUpdate use the data structure generated by this function.
The constant alpha determines the spread of the sigma points around x and is usually set to between 1e-3 and 1. beta incorporastes prior knowledge of the distribution of x and is 2 for a Gaussian distribution. kappa is set to 0 for state estimation and 3 - number of states for parameter estimation.
[w, wM, wC, c] = UKFWeight( d )
d (1,1) Data structure with constants .kappa (1,1) 0 for state estimation, 3-#states for parameter estimation .m (:,1) Vector of mean states .alpha (1,1) Determines spread of sigma points .beta (1,1) Prior knowledge - 2 for Gaussian
d (1,1) Data structure with constants .w (2*n+1,2*n+1) Weight matrix .wM (1,2*n+1) Weight array .c (1,1) Scaling constant .lambda (1,1) Scaling constant
function UKUDF | ( | in | action, |
in | d, | ||
in | y | ||
) |
Implement an Unscented Kalman Filter in UD (upper diagonal) form.
The filter uses numerical integration to propagate the state. The filter propagates sigma points, points computed from the state plus a function of the covariance matrix. For each state there are two sigma states.
The filter appends internal data to the datastructure
To initialize call
d = UKUDF( 'initialize', d );
To update
d = UKUDF( 'update', d, y );
d.x gives the current estimated state and d.pXX the state covariance.
The measurement function is of the form
meas = MeasFun( x, dMeasFun );
The state function is of the form
xDot = StateFun( x, t, dStateFun );
d = UKUDF( action, d, y )
action (1,:) 'initialize' or 'update' d (1,1) UKF data structure .rHSFun (1,:) Name of RHS function .rHSFunData (1,1) RHS function data structure .measFun (1,:) Name of measurement function .measFunData (1,1) Measurement function data .x (n,1) Initial state vector .p (n,n) Covariance matrix for x .dY (1,1) Number of measurements .L (1,1) Number of states .rP (n,n) Process noise covariance .rM (n,n) Measurement noise covariance .alpha (1,1) Scaling 1e-4 <= alpha <= 1 .kappa (1,1) Secondary scaling usually 0 .beta (1,1) Prior knowledge of distribution = 2 for Gaussian distributed noise .dT (1,1) Time step .t (1,1) Time y (m,1) Measurement vector
d (1,1) UKF data structure with the following appended .L (1,1) Number of states .n (1,1) Twice the number of states .y (m,1) Measurements based on the states .xA {n} Sigma points
References: Voss, H. U., Timmer, J., Kurths, J., "Nonlinear Dynamical System Identification from Uncertain and Indirect Measurements," International Journal of Bifurcation and Chaos, Vol. 14, No. 6, 2005, pp. 1905-1933.
Van der Merwe, R. and Wan, E., "The Square-Root Unscented Kalman Filter for State and Parameter Estimation".
function UnitVectorFromOffset | ( | in | v1, |
in | v2, | ||
in | cone, | ||
in | clock | ||
) |
Computes a unit vector offset from v2 with origin at v1.
It creates a random coordinate system with v2-v1 as the +z axis. cone is the angle from +z clock is the angle from +x in the xy-plane. This function is useful for creating a set of vectors but because the orientation of x and y is random you cannot externally specify the clock angle definition. Type UnitVectorFromOffset for a demo.
Forms: u = UnitVectorFromOffset u = UnitVectorFromOffset( v1, v2, cone ) u = UnitVectorFromOffset( v1, v2, cone, clock )
v1 (3,1) Origin v2 (3,1) Vector from which the offset is calcuated cone (1,1) Cone angle of the offset clock (1,1) Clock angle of the offset
u (3,1) Unit vector with offset
function UT12TT | ( | in | jDUT1 | ) |
Converts UT1 (time scale based on the rotation of the earth)
To Terrestrial Time (also known as TT or terrestrial (dynamic) time). UT1 = TT - DT where DT is determined from astronomical observations.
jDTT = UT12TT( jDUT1 )
jDUT1 (:,:) Julian date Universal Time 1
jDTT (:,:) Julian date Terrestrial (Dynamic) Time
function ValidTime | ( | in | t | ) |
function VantagePoint | ( | in | x, |
in | y, | ||
in | A, | ||
in | g, | ||
in | color | ||
) |
function VCFlatFile | ( | in | fileName, |
in | time, | ||
in | varargin | ||
) |
Write a set of variables to a VC flat file (comma-separated with header).
Assumes all variables have one dimension that matches the time vector, and it will tranpose all matrices as needed. The filename passed in should include the desired extension. The names of the input files are used in the header, so do not do a transpose of a variable in the call to this function, i.e.
VCFlatFile( fileName, time, theta, r' ) %% this will cause an error!
This file can be read into VC's default flat file reader. The matrices will automatically be reconstructed.
The file lookes like:
Time,theta,r,r,r 0,0,1,0,0, 1,0.1,0.995,0.1,0, ...
This example can be produced with the built-in demo. Type VCFlatFile for a demo.
VCFlatFile( fileName, time, varargin )
filename (:) Full filename of output file. time (1,n) args (p,n)
function VelocityLabel | ( | in | v | ) |
function VFToMassStructure | ( | in | v, |
in | f, | ||
in | d | ||
) |
Computes mass properties for a component defined by vertices and faces.
Mass and inertia are scaled for a unitary areal mass. Appropriate for plates and membranes.
mass = VFToMassStructure( v, f, d ) mass = VFToMassStructure( v, f )
Input
v (:,3) Vertices f (:,3) Faces d (:) Data structure (optional, see PolygonProps) .a (1,:) Areas of the triangles .r (3,:) Centroids of the triangles
Output
m (1,1) Structure .mass (1,1) Mass (area) .inertia (3,3) Inertia matrix .cM (3,1) Center of mass (centroid)
function View3D | ( | in | type | ) |
function VM2Int | ( | in | v | ) |
Converts apparent visual magnitude to intensity in watts/m^2.
The apparent visual magnitude of the Sun is -26.85.
i = VM2Int( v )
v (:) Visual magnitude
i (:) Intensity (watts/m^2)
References: Berry, M. (1981). Principles of cosmology and gravitation. Cambridge University Press, Cambridge, England, 10.
function Volumes | ( | in | x, |
in | type | ||
) |
Computes volumes of common objects about their c.m.
All objects have their axis of symmetry about z. If you enter a thickness with 'cylinder', 'box' or 'sphere' it will automatically compute the hollow versions. The 'cylindrical end caps' type has spherical end caps with the given radius.
vol = Volumes( x, type)
x Relevant dimensions type Type of solid 'sphere' x = [radius] 'cylinder' x = [radius, zLength] 'box' x = [xLength, yLength, zLength] 'ellipsoid' x = [a b c] 'plate' x = [xLength, yLength] 'disk' x = [radius, thickness] 'hollow cylinder' x = [outer radius, zLength, thickness] 'hollow box' x = [xLength, yLength, zLength, thickness] 'hollow sphere' x = [radius, thickness] 'torus' x = [R major,r minor] 'elliptical torus' x = [R major,a minor,b minor] 'cone' x = [radius,height] 'pyramid' x = [base,height] 'cylindrical end caps' x = [radius,length]
vol (1,1) Volume
function WaitBarManager | ( | in | action, |
in | d | ||
) |
function Watermark | ( | in | string, |
in | fig, | ||
in | pos, | ||
in | color | ||
) |
Add a watermark to a figure.
This function creates two axes, one for the image and one for the text. Calling it BEFORE plotting can cause unexpected results. It will reset the current axes after adding the watermark. The default position is the lower left corner, (2,2).
Leaving out the color input will cause the logo to use the color of the figure for the background. You can set a default color to a persistent variable using the second form; clear the function to reset it.
Watermark( string, fig, pos, color ) Watermark( color ), set a temporary background color Watermark( false ), turn watermarks off
string (1,:) Name, i.e. product name fig (1,1) Figure hangle pos (1,2) Coordinates, (left, bottom) color (3,1) Background color, [R G B]
none
function Wedge | ( | in | x1, |
in | x2, | ||
in | w, | ||
in | t | ||
) |
function Windup | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | p, | ||
in | sType | ||
) |
Implements anti windup compensation.
Given a state space system y[k] = C*x[k] + D*u[k] (1) x[k+1] = A*x[k] + B*u[k] (2) Implements anti windup compensation. This casts the system in the form y[k] = sat( C*x[k] + D*u[k] ) (3) x[k+1] = (A-L*C)*x[k] + (B-L*D)*u[k] + L*y[k] (4) {a,b,c,d} may also be in delta form.
[a, b, l] = Windup( a, b, c, d, p, sType )
a Controller state transition matrix b Controller input matrix c Controller state output matrix d Controller feedthrough matrix p Eigenvalues sType State equation type ('Delta' or 'Z')
a Plant matrix b Input matrix l Output matrix
function WPZ | ( | in | a, |
in | b, | ||
in | c, | ||
in | d, | ||
in | n, | ||
in | iu, | ||
in | iy | ||
) |
Frequency vector with complex poles and zeros.
This routine produces a frequency vector that includes all of the complex poles of the system and all complex zeros of each channel. This vector is useful for frequency response calculations.
w = WPZ( a, b, c, d, n, iu, iy ) w = WPZ( num, den, n )
a Plant matrix or numerator polynomials b Input matrix or denominator polynomials c Measurement matrix d Input feedthrough matrix n Number of frequency points iu Inputs ( = 0, or leave out for all) iy Outputs ( = 0, or leave out for all)
w Frequency vector
function WReson | ( | in | lmin, |
in | lmax, | ||
in | n, | ||
in | w | ||
) |
Creates a frequency vector with points around resonances.
The resonances are specified in the vector w. Only complex values of w will be used. Those with negative imaginary parts will be ignored. Thus you can enter the output of eig as an input to this function.
wV = WReson( lmin, lmax, n, w )
lmin Log of minimum frequency lmax Log of maximum frequency n Number of logarithmically spaced points w Resonances (complex)
wV Frequency vector
function WriteCM | ( | in | fID, |
in | matName, | ||
in | m, | ||
in | x, | ||
in | nD, | ||
in | nT, | ||
in | nPR | ||
) |
Write a matrix for use in a C or C++ program.
WriteCM( fID, matName, m, x, nD, nT, nPR )
fID File id matName Name of matrix for comment in C code m Name of matrix for C code x The matrix nD Number of decimal places nT Number of characters total nPR Number per row (default is 3 for matrices and 1 for vectors);
none
function XLabelS | ( | in | x, |
in | font | ||
) |
function YLabelS | ( | in | x, |
in | font | ||
) |
function YPF2T | ( | in | y | ) |
function Z2Damp | ( | in | z, |
in | T | ||
) |
Z domain to s domain damping and natural frequency.
Computes the damping ratio and natural frequency for a set of eigenvalues of a discrete time plant.
[zeta, w, wr, s] = Z2Damp( z, T )
z Points in the z-plane T Sampling period
zeta Damping ratio w Natural frequency wr Resonant frequency s Equivalent s-plane poles
function Z2S | ( | in | f, |
in | g, | ||
in | h, | ||
in | j, | ||
in | dT, | ||
in | sType | ||
) |
Transform an z-plane transfer function into the s-plane.
If only 3 inputs are given it assumes the input is in transfer function form. Otherwise it assumes state equation form.
[a, b, c, d] = Z2S( f, g, h, j, dT, sType ) [nums, dens] = Z2SBl( numz, denz, dT, sType )
f Discrete state matrix or numerator polynomial g Discrete input matrix or denominator polynomial h Output matrix j Feedthrough matrix T Sampling period sType 'bilinear', 'zoh', 'forward', 'backward'
a State matrix or nums b Input matrix or dens c Output matrix or T d Feedthrough matrix
References: Franklin, G.F., J.D. Powell, M.L. Workman, Digital Control of Dynamic Systems, 2nd Edition, Addison-Wesley, 1990, p. 137-147.
function ZFresp | ( | in | num, |
in | den, | ||
in | n | ||
) |
Generates the frequency response for a digital filter.
-1 -nb b(1) + b(2)z + Š + b(nb+1)z H(z) = --------------------------------- -1 -na a(1) + a(2)z + Š + a(na+1)z The routine interprets your input as follows: If only 2 arguments are input it computes the frequency response for 0 to ¼ at 512 points. If 3 arguments are entered and the third is a scalar it will interpret n as follows: if ( n > 2.25 ), do n point response between 0 and ¼ else if ( n < 2.25), if n is an integer do an n point response between 0 and ¼ else treat n as a scalar frequency end end if 4 arguments are entered it will do an n point response between 0 and 2.25.
[h, w] = ZFresp( num, den, n )
num Numerator polynomial den Denominator polynomial n Number of points
h Complex output vector w Frequency points
function ZLabelS | ( | in | x | ) |
function ZOH | ( | in | T, |
in | n | ||
) |
Create a model of a zero-order-hold using Padé approximants.
The ZOH will be scaled by 1/T as if it had a sampler in the loop.
[a, b, c, d] = ZOH( T, n ) [num, den] = ZOH( T, n )
T Hold period n Number of terms (optional)
a or num Numerator polynomial or plant matrix b or den Denominator polynomial or input matrix c Measurement matrix d Feedthrough matrix