MATLAB Examples

Create Periodic Input Data

This example shows how to create a periodic random Gaussian input signal using idinput.

Create a periodic input for one input and consisting of five periods, where each period is 300 samples.

per_u = idinput([300 1 5]);

Create an iddata object using the periodic input and leaving the output empty.

u = iddata([],per_u,'Period',.300);

View the data characteristics in time- and frequency-domain.

% Plot data in time-domain.
plot(u)
% Plot the spectrum.
spectrum(spa(u))

(Optional) Simulate model output using the data.

% Construct a polynomial model.
m0 = idpoly([1 -1.5 0.7],[0 1 0.5]);
% Simulate model output with Gaussian noise.
sim_opt = simOptions('AddNoise',true);
sim(m0,u,sim_opt)