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

📄 cp5_4.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%% Comprehensive Problem 5.4 %%%%%%%%%%%%   Discrete-Time Control Problems using        %%       MATLAB and the Control System Toolbox   %%   by J.H. Chow, D.K. Frederick, & N.W. Chbat  %%         Brooks/Cole Publishing Company        %%                September 2002                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Ball and Beam System              % System has 4 states, 1 input, and 2 outputs% 4 states : ball's position and velocity, and%            wheel's angular position and velocity% 1 input  : motor voltage (u)% 2 output : ball's position (xi), and %            wheel's angular position (theta)disp('CP5.4: Ball and Beam')%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Part A : Load model%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear; close all% Load continuous and discrete-time systemsif ~exist('bbeam.mat'),     dbbeamelseif exist('bbeam.mat') == 2,    load bbeam enddisp('Continuous-time System Gs is (in dbbeam):')Gsdisp('*******>');pausedisp('Continuous-time system poles')pole(Gs)disp('*******>');pausedisp('Zeros from wheel angle output')tzero(Gs(2,1))disp('Zeros from ball position output')tzero(Gs(1,1))disp('*******>');pause%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Part B : Sampling at 50Hz%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%disp('Sampling at 50 Hz :')fs = 50;   % sampling at 50 Hz Ts = 1/fs;Gz50 = c2d(Gs,Ts,'zoh');[Ad50,Bd50,Cd50,Dd50] = ssdata(Gz50);disp('Matrices A and B of the DT model sampled at 50 Hz are:')format short eAd50, Bd50formatdisp('Note that all the upper diagonal entries of Ad are nonzero')disp('*******>'); pause;disp('Poles of Gz50:'); pole(Gz50)disp('Similar to Ad and Bd in dbbeam')disp('Related to continuous system poles p by exp(p*Ts)')disp('*******>'); pause;disp('Zeros from wheel angle output')tzero(Gz50(2,1))disp('Zeros from ball position output')tzero(Gz50(1,1))disp('The relationship between the zeros of the continuous time ')disp('and discrete time zeros is quite involved and cannot be ')disp('obtained by inspection.')disp('*******>');pause%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Part C : Sampling at 25Hz%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%disp('Sampling at 25 Hz :')fs = 25;   % sampling at 25 Hz Ts = 1/fs;Gz25 = c2d(Gs,Ts,'zoh');[Ad25,Bd25,Cd25,Dd25] = ssdata(Gz25);disp('Matrices A and B of the DT model sampled at 25 Hz are:')Ad25, Bd25disp('Poles of Gz25:'); pole(Gz25)disp('Note the poles not at z = 1 have smaller magnitude when')disp('the system is sampled slower.')disp('*******>');pause; disp('Zeros from wheel angle output')tzero(Gz25(2,1))disp('Zeros from ball position output')tzero(Gz25(1,1))disp('*******>');pause%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Part D : Sampling at 100Hz%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%disp('Sampling at 100 Hz :')fs = 100;   % sampling at 100 Hz Ts = 1/fs;Gz100 = c2d(Gs,Ts,'zoh');[Ad100,Bd100,Cd100,Dd100] = ssdata(Gz100);disp('Matrices A and B of the DT model sampled at 100 Hz are:')Ad100, Bd100disp('Poles of Gz100:'); pole(Gz100)disp('Note the poles not at z = 1 have larger magnitude when')disp('the system is sampled faster.')disp('*******>');pause; disp('Zeros from wheel angle output')tzero(Gz100(2,1))disp('Zeros from ball position output')tzero(Gz100(1,1))disp('*******>');pause; disp(' ');disp('End of Comprehensive Problem CP5.4')%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

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