Example H3.5
Matlab code for example 3.5 from the book "Regeltechniek voor het HBO"
Determine sinusoidal response with the aid of a pz-map: a second order system
- Date : 28/07/2021
- Revision : 2.0
Copyright (c) 2021, Studieboeken Specialist Permission is granted to copy, modify and redistribute this file, provided that this header message is retained.
Initialisation for Matlab code
% clear all variables from Workspace and close all figures
% Disable warnings on complex valued poles and zeros
warning off Control:ltiobject:TFComplex
Response proces to sine input:
First show results in s-domain. Calculate and show the poles of % Define the transfer function of the system
zpk(Y)
ans =
22.5 s
------------------------
(s^2 + 4s + 8) (s^2 + 9)
Continuous-time zero/pole/gain model.
Define input parameters to show response to an sine input:
Tsim1=4; % Simulation time in seconds
x_omega1=3; % frequency in rad/s
x_amp1=5; % amplitude of the sine wave
x1 = x_amp1*sin(x_omega1*t1);
% Simulate the response of system H to the input x1
title('Response to a sine input 5*sin(3t)');
Response proces to input with high sine frequency compared to system
Define input parameters and notice that output starts a zero value and that the sine will eventually have zero as its average value. But also the amplitude has become lower.
Tsim2=0.5; % Simulation time in seconds
x_omega2=60; % frequency in rad/s
x_amp2=5; % amplitude of the sine wave
x2 = x_amp2*sin(x_omega2*t2);
% Simulate the response of system H to an input x2
title('Response to a sine input with high frequency');
Response proces to input with low sine frequency compared to system
Define input parameters and notice that also the amplitude has become lower.
Tsim3=100; % Simulation time in seconds
x_omega3=0.3; % frequency in rad/s
x_amp3=5; % amplitude of the sine wave
x3 = x_amp3*sin(x_omega3*t3);
% Simulate the response of system H to an input x3
title('Response to a sine input with low frequency');
Generate Matlab figure(s) for usage in the book
Init create Enhanced Figures
Close all the earlier enhanced figures with a certain tag
EnhancedFig = findobj(0, 'Tag', 'EnhancedImage');
Enhance the figures
set(gcf, 'Tag','EnhancedImage');
% create the pzmap plot again but now with a figure handle
% get the handle to the plot options
p.Title.String='PN beeld van \itY(s)';
% write the options to the figure
set(gcf, 'Tag','EnhancedImage');
% create the timeresponse plot again but now with a figure handle
% get the handle to the plot options
p.Title.String='Sinusresponsie \ity(t)';
% Make input invisible. If this does not work
% create the figure again with this code in an m-
% script and toggle with a right mouse click in
% the figure the input signal
% write the options to the figure
set(gcf, 'Tag','EnhancedImage');
% create the bodeplot with a figure handle
% get the handle to the plot options
p.Title.String='Bodediagram \itH(s)';
% write the options to the figure