Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Control Design   

Troubleshooting Frequency Response Estimation

When to Troubleshoot

After you estimate the frequency response, you can analyze the results. If the frequency response plot does not match the expected behavior of your system, you can use the time response and FFT plots to help you improve the results.

If your estimation is slow or exceeds memory requirements, see Managing Estimation Speed and Memory.

Time Response Not at Steady State

 What Does This Mean?

 How Do I Fix It?

Example – Effects of Time-Varying Simulink Source Blocks on Frequency Response Estimation

Compare the linear model obtained using exact linearization techniques with the estimated frequency response:

% Open the model
mdl = 'scdspeed_ctrlloop';
open_system(mdl)
io = getlinio(mdl);

% Set the model reference to normal mode for accurate linearization
set_param('scdspeed_ctrlloop/Engine Model','SimulationMode','Normal')

% Linearize the model
sys = linearize(mdl,io);

% Estimate the frequency response between 10 and 100 rad/s
in = frest.Sinestream('Frequency',logspace(1,2,10),'NumPeriods',30,'SettlingPeriods',25);
[sysest,simout] = frestimate(mdl,io,in);

% Compare the results
frest.simView(simout,in,sysest,sys)

The resulting time response has not reached steady state for the first two of frequencies. The step input and external disturbances drive the model away from the operating point. Thus, the linearization results do not match the estimated frequency response. To view the unfiltered time response, right-click the time response plot, and select Show filtered steady state output only.

Disable the source blocks by opening the loop at the output of these blocks:

io(1).OpenLoop = 'on';
io(3) = linio('scdspeed_ctrlloop/External Disturbance',1,'none','on');

Repeat the frequency response estimation:

[sysest2,simout2] = frestimate(mdl,io,in);
frest.simView(simout2,in,sysest2,sys);

The resulting frequency response matches the exact linearization results. To view the unfiltered time response, right-click the time response plot, and select Show filtered steady state output only.

FFT Contains Large Harmonics at Frequencies Other than the Input Signal Frequency

 What Does This Mean?

 How Do I Fix It?

Time Response Grows Without Bound

 What Does This Mean?

 How Do I Fix It?

Time Response Is Discontinuous or Zero

 What Does This Mean?

 How Do I Fix It?

Time Response Is Noisy

 What Does This Mean?

 How Do I Fix It?

Example – Effects of Noise on Frequency Response Estimation

Compare the linear model obtained using exact linearization techniques with the estimated frequency response:

mdl = 'f14';
open_system(mdl)
io(1) = linio('f14/Sum1',1)
io(2) = linio('f14/Gain5',1,'out')
sys = linearize(mdl,io);
in = frest.Sinestream(sys);
[sysest,simout] = frestimate(mdl,io,in);
frest.simView(simout,in,sysest,sys)

The resulting frequency response does not match the linearization results due to the effects of the Pilot and Wind Gust Disturbance blocks. To view the effects of effects of the noise on the time response of the first frequency, right-click the time response plot and select Show filtered steady state output only.

Disable the source blocks by opening the loop at the output of these blocks:

io(3) = linio('f14/Pilot',1,'none','on')
io(4) = linio('f14/Dryden Wind Gust Models',1,'none','on')
io(5) = linio('f14/Dryden Wind Gust Models',2,'none','on')

Repeat the frequency response estimation:

[sysest,simout] = frestimate(mdl,io,in);
frest.simView(simout,in,sysest,sys);

The resulting frequency response matches the exact linearization results.

Example – Estimating Frequency Response Models with Noise Using Signal Processing Toolbox

Open the Simulink model, and specify which portion of the model to linearize:

magball
io(1) = linio('magball/Desired Height',1);
io(2) = linio('magball/Magnetic Ball Plant',1,'out');

Create a random input signal for simulation:

in = frest.Random('Ts',0.001,'NumSamples',1e4);

Linearize the model at a steady-state operating point:

op = findop('magball',operspec('magball'),...
                      linoptions('DisplayReport','off'));
sys = linearize('magball',io,op);

Simulate the model to obtain the output at the linearization output point:

[sysest,simout] = frestimate('magball',io,in,op);

Estimate a frequency response model using Signal Processing Toolbox software, which includes windowing and averaging:

input = generateTimeseries(in);
output = detrend(simout{1}.Data,'constant');
[Txy,F] = tfestimate(input.Data(:),...
          output,hanning(4000),[],4000,1/in.Ts);    
systfest = frd(Txy,2*pi*F);

Compare the results of analytical linearization and tfestimate:

ax=axes;
h = bodeplot(ax,sys,'b',systfest,'g',systfest.Frequency);
setoptions(h,'Xlim',[10,1000],'PhaseVisible','off');
legend(ax,'Linear model using LINEARIZE','Frequency response using Signal Processing Toolbox',...
			'Location','SouthWest')

In this case, the Signal Processing Toolbox command tfestimate gives a more accurate estimation than frestimate due to windowing and averaging.

Example – Estimating Frequency Response Models with Noise Using System Identification Toolbox

Open the Simulink model, and specify which portion of the model to linearize:

magball
io(1) = linio('magball/Desired Height',1);
io(2) = linio('magball/Magnetic Ball Plant',1,'out');

Compute the steady-state operating point, and linearize the model:

op = findop('magball',operspec('magball'),...
                      linoptions('DisplayReport','off'));
sys = linearize('magball',io,op);

Create a chirp signal, and use it to estimate the frequency response:

in = frest.Chirp('FreqRange',[1 1000],...
                             'Ts',0.001,...
                             'NumSamples',1e4);
[~,simout] = frestimate('magball',io,op,in);

Use System Identification Toolbox software to estimate a fifth-order, state-space model. Compare the results of analytical linearization and the state-state model:

input = generateTimeseries(in);
output = simout{1}.Data;
data = iddata(output,input.Data(:),in.Ts);
sys_id = n4sid(detrend(data),5,'cov','none');
bodemag(sys,ss(sys_id('measured')),'r')
legend('Linear model obtained using LINEARIZE',...
       'State-space model using System Identification Toolbox',...
       'Location','SouthWest')

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS