Deprecated: Constant E_STRICT is deprecated in /home/polpe/public_html/system/core/Exceptions.php on line 75

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 101

Backtrace:

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Router::$uri is deprecated

Filename: core/Router.php

Line Number: 127

Backtrace:

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$benchmark is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$hooks is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$config is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$log is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$utf8 is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$uri is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$exceptions is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$router is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$output is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$security is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$input is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$lang is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$load is deprecated

Filename: core/Controller.php

Line Number: 78

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$parser is deprecated

Filename: core/Loader.php

Line Number: 1290

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 1290

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$MyModel is deprecated

Filename: core/Loader.php

Line Number: 353

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 15
Function: __construct

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 282

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 289

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 304

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 314

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 315

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 316

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 317

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: drivers/Session_files_driver.php

Line Number: 94

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 108

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Session cannot be started after headers have already been sent

Filename: Session/Session.php

Line Number: 141

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Main::$session is deprecated

Filename: core/Loader.php

Line Number: 1290

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$benchmark is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$hooks is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$config is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$log is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$utf8 is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$uri is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$exceptions is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$router is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$output is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$security is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$input is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$lang is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$load is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$parser is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$MyModel is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$session is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 18
Function: view

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

Polcz Péter honlapja

Tartalomjegyzék

Frequency domain analysis

Teljes Matlab script kiegészítő függvényekkel.

File: minimum_phase_systems.m
Directory: 4_gyujtemegy/11_CCS/04_frequency_domain_analysis
Author: Peter Polcz (ppolcz@gmail.com)
Created on 2018. April 22.

Automatically generated stuff

Output:
 
┌ <a href="matlab:edit('/home/ppolcz/Repositories/Bitbucket/control-systems/4_gyujtemegy/11_CCS/04_frequency_domain_analysis/minimum_phase_systems.m')">minimum_phase_systems</a> called from <a href="matlab:opentoline('',115)">instrumentAndRun:115</a>
│   [  <strong>INFO </strong> ] Persistence for `minimum_phase_systems` reused (inherited) [run ID: 0622, 2018.04.22. Sunday, 20:14:36]
│   [  <strong>INFO </strong> ] Script `minimum_phase_systems` backed up.

Minium phase system with large overshoot

Example 1. [smaller order]

Minimum phase system, which has a very high overshoot. If we remove the high frequency components from the step function, we obtain a beautiful transient.

syms s

b = [1 3 2];
a = poly([ -3 -4 -5 ]);

H = tf(b,a);
DC_gain = dcgain(H);

H = H / DC_gain;
H_sym = poly2sym(b,s)/poly2sym(a,s) / DC_gain;
H_fh = matlabFunction(H_sym);

if exist('fig2','var')
    delete(fig2)
end

fig2 = figure(2);
set(fig2, 'Position', [ 383 2 1461 1000 ], 'Color', [1 1 1])

subplot(231),
bopts = bodeoptions;
bopts.FreqUnits = 'Hz';
bodeplot(H,bopts), grid on

subplot(232), nyquist(H), grid on

subplot(233), step(H), grid on

subplot(425);

f = 1;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg]', f, argHw))
legend input output

subplot(427);

f = 2;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg] + 360 = %g [deg]', f, argHw, argHw + 360))
legend input output


% Lowpass filter design
% openExample('dsp/LowpassFilterDesignExample')
N   = 420;
Fs  = 1;
Fp  = 2e-3;
Ap  = 0.1;
Ast = 80;

Rp  = (10^(Ap/20) - 1)/(10^(Ap/20) + 1);
Rst = 10^(-Ast/20);

window = firceqrip(N,Fp/(Fs/2),[Rp Rst],'passedge');
% fvtool(window,'Fs',Fs);

subplot(428);

T = 1000;
Ts = 1/Fs;
t = 0:Ts:T;
u_step = double( t > T/5 );
u = filter(window,1,u_step);
y = lsim(H,u,t);

plot(t,u_step), hold on
plot(t,u), hold on
plot(t,y), grid on
title('Response of the lowpass filtered step function')
legend step input output

Example 2. [higher order]

syms s

b = poly([-0.1 -2 -3.1 -4.2 -2]);
a = poly([-1.1 -2.2 -1 -3 -4 -5 ]);

H = tf(b,a);
DC_gain = dcgain(H);

H = H / DC_gain;
H_sym = poly2sym(b,s)/poly2sym(a,s) / DC_gain;
H_fh = matlabFunction(H_sym);

if exist('fig2','var')
    delete(fig2)
end

fig2 = figure(2);
set(fig2, 'Position', [ 383 2 1461 1000 ], 'Color', [1 1 1])

subplot(231),
bopts = bodeoptions;
bopts.FreqUnits = 'Hz';
bodeplot(H,bopts), grid on

subplot(232), nyquist(H), grid on

subplot(233), step(H), grid on

subplot(425);

f = 1;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg]', f, argHw))
legend input output

subplot(427);

f = 2;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg] + 360 = %g [deg]', f, argHw, argHw + 360))
legend input output


% Lowpass filter design
% openExample('dsp/LowpassFilterDesignExample')
N   = 420;
Fs  = 1;
Fp  = 2e-3;
Ap  = 0.1;
Ast = 80;

Rp  = (10^(Ap/20) - 1)/(10^(Ap/20) + 1);
Rst = 10^(-Ast/20);

window = firceqrip(N,Fp/(Fs/2),[Rp Rst],'passedge');
% fvtool(window,'Fs',Fs);

subplot(428);

T = 1000;
Ts = 1/Fs;
t = 0:Ts:T;
u_step = double( t > T/5 );
u = filter(window,1,u_step);
y = lsim(H,u,t);

plot(t,u_step), hold on
plot(t,u), hold on
plot(t,y), grid on
title('Response of the lowpass filtered step function')
legend step input output

Non-minimum phase system

Example 1

syms s

b = poly([0.1 -2 -3.1 -4.2 -2]);
a = poly([-1.1 -2.2 -1 -3 -4 -5 ]);

H = tf(b,a);
DC_gain = dcgain(H);

H = H / DC_gain;
H_sym = poly2sym(b,s)/poly2sym(a,s) / DC_gain;
H_fh = matlabFunction(H_sym);

if exist('fig2','var')
    delete(fig2)
end

fig2 = figure(2);
set(fig2, 'Position', [ 383 2 1461 1000 ], 'Color', [1 1 1])

subplot(231),
bopts = bodeoptions;
bopts.FreqUnits = 'Hz';
bodeplot(H,bopts), grid on

subplot(232), nyquist(H), grid on

subplot(233), step(H), grid on

subplot(425);

f = 1;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg]', f, argHw))
legend input output

subplot(427);

f = 2;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg] + 360 = %g [deg]', f, argHw, argHw + 360))
legend input output


% Lowpass filter design
% openExample('dsp/LowpassFilterDesignExample')
N   = 420;
Fs  = 1;
Fp  = 2e-3;
Ap  = 0.1;
Ast = 80;

Rp  = (10^(Ap/20) - 1)/(10^(Ap/20) + 1);
Rst = 10^(-Ast/20);

window = firceqrip(N,Fp/(Fs/2),[Rp Rst],'passedge');
% fvtool(window,'Fs',Fs);

subplot(428);

T = 1000;
Ts = 1/Fs;
t = 0:Ts:T;
u_step = double( t > T/5 );
u = filter(window,1,u_step);
y = lsim(H,u,t);

plot(t,u_step), hold on
plot(t,u), hold on
plot(t,y), grid on
title('Response of the lowpass filtered step function')
legend step input output

Example 2

syms s

b = poly([0.1 2 3.1 -4.2 -2]);
a = poly([-1.1 -2.2 -1 -3 -4 -5 ]);

H = tf(b,a);
DC_gain = dcgain(H);

H = H / DC_gain;
H_sym = poly2sym(b,s)/poly2sym(a,s) / DC_gain;
H_fh = matlabFunction(H_sym);

if exist('fig2','var')
    delete(fig2)
end

fig2 = figure(2);
set(fig2, 'Position', [ 383 2 1461 1000 ], 'Color', [1 1 1])

subplot(231),
bopts = bodeoptions;
bopts.FreqUnits = 'Hz';
bodeplot(H,bopts), grid on

subplot(232), nyquist(H), grid on

subplot(233), step(H), grid on

subplot(425);

f = 1;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg]', f, argHw))
legend input output

subplot(427);

f = 2;
w = 2*pi*f;
t = linspace(0,4/f,500);
u = sin(w*t);

absHw = abs(H_fh(1i*w));
argHw = angle(H_fh(1i*w)) / pi * 180;

y = lsim(H,u,t) / absHw;

plot(t,u), hold on
plot(t,y), grid on
title(sprintf('Frequency = %g [Hz], Phase shift = %g [deg] + 360 = %g [deg]', f, argHw, argHw + 360))
legend input output


% Lowpass filter design
% openExample('dsp/LowpassFilterDesignExample')
N   = 420;
Fs  = 1;
Fp  = 2e-3;
Ap  = 0.1;
Ast = 80;

Rp  = (10^(Ap/20) - 1)/(10^(Ap/20) + 1);
Rst = 10^(-Ast/20);

window = firceqrip(N,Fp/(Fs/2),[Rp Rst],'passedge');
% fvtool(window,'Fs',Fs);

subplot(428);

T = 1000;
Ts = 1/Fs;
t = 0:Ts:T;
u_step = double( t > T/5 );
u = filter(window,1,u_step);
y = lsim(H,u,t);

plot(t,u_step), hold on
plot(t,u), hold on
plot(t,y), grid on
title('Response of the lowpass filtered step function')
legend step input output
Output:
└ 10.3037 [sec]