Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

## Appendix A: State-Space Models to FAUST

A digital state-space model is normally written mathematically as

where

• state vector at time
• vector of inputs
• output vector
• state transition matrix
• input coefficient matrix
• output coefficient matrix
• direct path coefficient matrix
The matrices , and make up the feedforward part, while is the feedback part.

Note that all four matrices may change each sample instant to implement a general time-varying linear system.

A FAUST example for the general linear state-space model is shown in Fig.19. The FAUST-generated block diagram is shown in Fig.20.

Since a state-space model can implement any th-order linear system with inputs and outputs, all we have to do is come up with the matrix entries and use the general state-space formulation in FAUST given in Fig.19.

Here are the steps for finding the state-space matrices:

1. Label each delay element as a state variable . Delay lines can be treated as one generalized delay'' (Feedback Delay Networks are often written this way). In terms of the mathematical description above, the th delay input is , and the output is .

2. By tracing connections in the block diagram, write as a linear combination of either inputs or states for each . Place these coefficients where they go in the th row of (for inputs) and (for states), and enter zeros for inputs and states not needed to create .

3. Now do the same for each output , , which is similarly a linear combination of inputs and/or states. Use these coefficients to populate the th row of (for inputs) and (for states).

4. Now you've filled your matrices, so they can be plugged into FAUST code based on Fig.19.

A simple example for trying out and checking this process can be found by starting at step 3 of Converting to State-Space Form by Hand'' [11].26 The details appear below in §A.1. Also be aware of the matlab function tf2ss for converting a transfer function to state-space form.

 // General Linear State-Space Model Example import("stdfaust.lib"); p = 2; // number of inputs q = 3; // number of outputs N = 5; // number of states A = matrix(N,N); // state transition matrix B = matrix(N,p); // input-to-states matrix C = matrix(q,N); // states-to-output matrix D = matrix(q,p); // direct-term matrix, bypassing state matrix(M,N) = tgroup("Matrix: %M x %N", par(in, N, _) <: par(out, M, mixer(N, out))) with { fader(in) = ba.db2linear(vslider("Input %in", -10, -96, 4, 0.1)); mixer(N,out) = hgroup("Output %out", par(in, N, *(fader(in)) ) :> _ ); }; Bd = par(i,p,mem) : B; // input delay needed for conventional definition vsum(N) = si.bus(2*N) :> si.bus(N); // vector sum of two N-vectors impulse = 1-1'; // For zero initial state, set impulse = 0 or simplify code x0 = par(i,N,i*impulse); // initial state = (0,1,2,3,...,N-1) system = si.bus(p) <: D, (Bd : vsum(N)~(A), x0 : vsum(N) : C) :> si.bus(q); process = system; 

Subsections
Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search