⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genrprep.m

📁 控制系统计算机辅助设计——MATLAB语言与应用(源代码)
💻 M
字号:
% GENRPREP Data generation for CALCDEMO and MVPLDEMO in MFD Toolbox.

echo off
% J.M.Woollatt, 1 March 1989
% Copyright (c) 1989 by GEC Engineering Research Centre & Cambridge Control Ltd
% MRN0020

% This file was created by editing GENRDEMO.M 


% 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

%   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.


% 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];

format short e

% 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 toolbox function TZERO.

crzeros = tzero(a,b,c,d)';
% The first two zeros are infinite zeros. The second two are the finite ones.

format

% Now generate a vector w, containing the frequencies, in radians, 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 establish the size of the component matrices, use:

fsize(w,mvfr);

% 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);

% The MVFR matrix will be saved in the .mat file genrdata
% for use by future demos.
save genrdata

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -