Map past input/output data to current states of nonlinear ARX model
X = data2state(MODEL,IOSTRUCT)
X = data2state(MODEL,DATA)
X = data2state(MODEL,IOSTRUCT) maps the input and output samples in IOSTRUCT to the current states of MODEL, X. For a definition of the states of idnlarx models, see Definition of idnlarx States. The data in IOSTRUCT is interpreted as past samples of data, so that the returned state values must be interpreted as values at the time immediately after the time corresponding to the last (most recent) sample in the data.
X = data2state(MODEL,DATA) maps the input and output samples from DATA to the current states, X, of the model.
MODEL: idnlarx model.
IOSTRUCT: Structure with fields Input and Output. Samples in IOSTRUCT must be in the order of increasing time (the last row of values corresponds to the most recent time). Each field contains data samples corresponding to the past input and output of MODEL respectively.
Input: Matrix of NU columns, where NU is the number of inputs. The number of rows can be equal to either of the following:
Maximum input delay in MODEL (maximum across all input variables).
1 to specify steady-state (constant) input values.
Output: Matrix of NY columns, where NY is the number of outputs. The number of rows can be equal to either of the following:
Maximum input delay in MODEL (maximum across all output variables).
1 to specify steady-state (constant) output values.
DATA: iddata object containing data samples. Samples in DATA must be in the order of increasing time (the last row of values corresponds to the most recent time). The number of samples in DATA must be greater than or equal to the maximum delay in the model across all input and output variables.
X is the state vector of MODEL corresponding to the time after the most recent sample in the input data (IOSTRUCT or DATA).
In this example you determine the current state of an idnlarx model.
Load your data and create a data object.
load motorizedcamera; z = iddata(y,u,0.02,'Name','Motorized Camera', ... 'TimeUnit','s');
Estimate an idnlarx model from the data. The model has 6 inputs and 2 outputs.
mw1 = nlarx(z,[ones(2,2),ones(2,6),ones(2,6)],wavenet);
Compute the maximum delays across all output variables in mw1.
MaxDelays = getDelayInfo(mw1);
Represent the past input and output samples:
IOData = struct('Input', ... rand(max(MaxDelays(3+1:end)),6),... 'Output', ... rand(max(MaxDelays(1:3)),2));
Compute the current states of mw1 based on the past data in IOSTRUCT.
X = data2state(mw1,IOData)
The previous command computes the state vector.