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

📄 chap6_2plant.m

📁 该程序是由matlab语言针对<先进PID控制及其MATLAB仿真>编写的,希望对大家有用.
💻 M
字号:
function [sys,x0,str,ts]=mm_model_nl(t,x,u,flag,T)
switch flag,
case 0 % Initialization
    [sys,x0,str,ts] = mdlInitializeSizes(T);
case 3 % evaluation of outputs
    sys = mdlOutputs(u);
case {1, 2, 4, 9} % undefined flag values
    sys = [];
otherwise % error handling
    error(['Unhandled flag = ',num2str(flag)]);
end;

%==============================================================
% when flag==0, initialization processed for the system
%==============================================================
function [sys,x0,str,ts] = mdlInitializeSizes(T)
sizes = simsizes; % read the default templates for the system variables
sizes.NumContStates = 0; % no continuous states
sizes.NumDiscStates = 0; % 6 discrete states, [x1-x3]
sizes.NumOutputs = 2; % control variable u(k) and PID parameters
sizes.NumInputs = 6; % 7 input signals
sizes.DirFeedthrough = 1; % inputs are needed in output evaluation
sizes.NumSampleTimes = 1; % single sampling period
sys = simsizes(sizes); % setting of system variables
x0 = []; % zero states, and 0.1 for initial weights
str = []; 
ts = [T 0]; % T is the sampling period for the system

function sys = mdlOutputs(u)
sys=[(0.8*u(1)+u(3)+0.2*u(6))/(1+u(1))^2;
     (0.9*u(2)+0.3*u(4)+u(5))/(1+u(2))^2];

⌨️ 快捷键说明

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