opt = forecastOptions creates
the default option set for forecast.
Use dot notation to modify this option set. Any options that you do
not modify retain their default values.
Specify the input offset for a single-input data set as 5.
opt.InputOffset = 5;
You can now use this option set for forecasting. Before forecasting model response, the forecast command subtracts this offset value from the past input data signal.
Specify Handling of Initial Conditions During Model Forecasting
z1 and z2 are iddata objects that store SISO input-output data. Create a two-experiment data set from z1 and z2.
z = merge(z1,z2);
Estimate a transfer function model with 2 poles using the multi-experiment data.
sys = tfest(z,2);
Specify the offset as -1 and 1 for the output signals of the two experiments.
opt = forecastOptions('OutputOffset',[-1 1]);
OutputOffset is specified as an Ny-by-Ne matrix where Ny is the number of outputs in each experiment, and Ne is the number of experiments. In this example, Ny is 1 and Ne is 2.
Using the option set opt, forecast the response of the model 10 time steps into the future. The software subtracts the offset value OutputOffset(i,j) from the output signal i of experiment j before using the data in the forecasting algorithm. The removed offsets are added back to generate the final result.
y = forecast(sys,z,10,opt)
y =
Time domain data set containing 2 experiments.
Experiment Samples Sample Time
Exp1 10 0.1
Exp2 10 0.1
Outputs Unit (if specified)
y1
Inputs Unit (if specified)
u1
y is an iddata object that returns the forecasted response corresponding to each set of past experimental data.
Specify optional
comma-separated pairs of Name,Value arguments. Name is
the argument name and Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
Example: forecastOptions('InitialCondition','e') specifies
that the software estimates the initial conditions of the measured
input-output data such that the 1-step prediction error for observed
output is minimized.
Handling of initial conditions, specified as the comma-separated
pair consisting of 'InitialCondition' and one of
the following values:
'z' — Zero initial conditions.
'e' — Estimate initial conditions
such that the 1-step prediction error is minimized for the observed
output.
For nonlinear grey-box models, only those initial states i that
are designated as free in the model (sys.InitialStates(i).Fixed
= false) are estimated. To estimate all the states of the
model, first specify all the Nx states of the idnlgrey model sys as
free.
for i = 1:Nx
sys.InitialStates(i).Fixed = false;
end
Similarly, to fix all the initial states to values specified
in sys.InitialStates, first specify all the states
as fixed in the sys.InitialStates property of the
nonlinear grey-box model.
x0obj — Specification object
created using idpar. Use this
object for discrete-time state-space models only (idss, idgrey,
and idnlgrey). Use x0obj to
impose constraints on the initial states by fixing their value or
specifying minimum or maximum bounds.
Input signal offset for time-domain data, specified as the comma-separated
pair consisting of 'InputOffset' and one of the
following values:
[] — No input offsets.
A column vector of length Nu, where Nu is
the number of inputs. When you use the forecast command,
the software subtracts the offset value InputOffset(i) from
the ith input signals in the past and future input
values. You specify these values in the PastData and FutureInputs arguments of forecast.
The software then uses the offset subtracted inputs to forecast the
model response.
Nu-by-Ne matrix
— For multi-experiment data, specify InputOffset as
an Nu-by-Ne matrix, where Ne is
the number of experiments. The software subtracts the offset value InputOffset(i,j) from
the ith input signal of the jth
experiment in the PastData and FutureInputs arguments
of forecast before forecasting.
Output signal offset for time-domain data, specified as the
comma-separated pair consisting of 'OutputOffset' and
one of the following values:
[] — No output offsets.
A column vector of length Ny, where Ny is
the number of outputs. When you use the forecast command,
the software subtracts the offset value OutputOffset(i) from
the ith past output signal that you specify in
the PastData argument
of forecast. The software then uses the offset
subtracted output to compute the detrended forecasts. The removed
offsets are added back to the detrended forecasts to generate the
final result.
Ny-by-Ne matrix
— For multi-experiment data, specify OutputOffset as
an Ny-by-Ne matrix, where Ne is
the number of experiments. Before forecasting, the software subtracts
the offset value OutputOffset(i,j) from the ith
output signal of the jth experiment in the PastData argument
of forecast. For an example, see Specify Output Offset for Forecasting Multi-Experiment Data.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.