📄 genrdemo.m
字号:
% GENRDEMO MVFR Generation and Display Demonstration for MFD Toolbox.
echo off
% J.M Boyle 30th August 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
% History:
% `more on' added, comment about zeros changed, remark
% about CTRL-S removed, 12.7.93, JMM.
% 8/2/88 TSM names of arrays 'poles zeros' changed to 'crpoles crzeros'
% MRN0016
% MRN0017
% MRN0023
clc
echo on
% This demo shows how MultiVariable Frequency Response (MVFR)
% matrices can be generated and displayed.
% A system with n inputs and m outputs, has a frequency response
% matrix represented by a single complex matrix.
% To store the response of a system over a frequency range, the
% matrices for each frequency are stacked on top of each other.
% The associated frequency vector 'w' specifies the frequencies at
% which the MVFR matrix has been evaluated.
% For example, a system with m outputs and n inputs
% is defined at 10 frequency points by:
% - a frequency vector of dimensions: 1 by 10.
% plus,
% - a complex matrix of dimensions: 10*m by n
pause % Strike any key to continue.
clc
% An MVFR matrix can be calculated from either:
% - A Transfer Function Matrix description:
% G(s) = NUM(s)/Comden(s)
% or
% - The A,B,C,D matrices of a State Space description.
pause % Strike any key to continue.
clc
% We start by entering our A,B,C & D matrices for the state
% space description of a 2 input - 2 output open-loop unstable
% Chemical Reactor (Ref: [2] in the MFD Tutorial)
a=[ 1.3800 -0.2077 6.7150 -5.6760
-0.5814 -4.2900 0.0000 0.6750
1.0670 4.2730 -6.6540 5.8930
0.0480 4.2730 1.3430 -2.1040];
b=[0.000 0.000
5.679 0.000
1.136 -3.146
1.136 0.000];
c=[1 0 1 -1
0 1 0 0];
d=[0 0
0 0];
pause % Strike any key to continue.
format short e
clc
% The Chemical Reactor has two right-half plane poles and is
% therefore open loop unstable.
% The finite zeros are both in the left-half plane.
% Poles are found by calculating the eigenvalues of the A matrix
crpoles = eig(a)'
% Transmission zeros are found using the Control System
% Toolbox function TZERO.
crzeros = tzero(a,b,c,d)'
pause % Strike any key to continue.
format
clc
% Now generate a vector w, containing the frequencies,
% in radians/(time unit), at which the MVFR matrix is
% to be evaluated:
w = logspace(-2,2,9);
% Then to generate the MVFR matrix we use
mvfr = mv2fr(a,b,c,d,w);
% To display the component matrices use, FDISP(w,mvfr). FDISP displays
% an MVFR matrix together with the associated frequency vector.
% First the frequency is displayed then the associated response matrix.
pause % Strike any key to display the MVFR matrix
more on % Added 12.7.93, JMM
fdisp(w,mvfr)
pause % Strike any key to continue
more off % Added 12.7.93, JMM
clc
% To establish the size of the component matrices, use:
fsize(w,mvfr)
pause % Strike any key to continue.
clc
% To speed-up computations, you might wish to work with a
% subset of the frequency points. FCOMP returns the first
% component matrix of the MVFR matrix, and every Nth + 1
% component matrix thereafter. Here we take every fourth point.
[mvfrs,ws] = fcomp(w,mvfr,4);
pause % Strike any key to display the subset of MVFR matrices.
clc
fdisp(ws,mvfrs)
pause % Strike any key to continue.
clc
% The MFD TOOLBOX can also handle systems with time delays using
% the function FDLY.
% End of Demo
% The MVFR matrix will be saved in the .mat file genrdata
% for use by future demos.
save genrdata
pause % Strike any key to return to the Main Menu.
echo off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -