标签:irf handle cti patch tin mes through format info
该块输入一个标量信号,将信号加倍,然后输出到一个 scope进行显示。
function [sys,x0,str,ts] = timestwo(t,x,u,flag) % Dispatch the flag. The switch function controls the calls to % S-function routines at each simulation stage. switch flag, case 0 [sys,x0,str,ts] = mdlInitializeSizes; % Initialization case 3 sys = mdlOutputs(t,x,u); % Calculate outputs case { 1, 2, 4, 9 } sys = []; % Unused flags otherwise error([‘Unhandled flag = ‘,num2str(flag)]); % Error handling end; % End of function timestwo.
%==============================================================
% Function mdlInitializeSizes initializes the states, sample
% times, state ordering strings (str), and sizes structure.
%==============================================================
function [sys,x0,str,ts] = mdlInitializeSizes
% Call function simsizes to create the sizes structure.
sizes = simsizes;
% Load the sizes structure with the initialization information.
sizes.NumContStates= 0;
sizes.NumDiscStates= 0;
sizes.NumOutputs= 1;
sizes.NumInputs= 1;
sizes.DirFeedthrough=1;
sizes.NumSampleTimes=1;
% Load the sys vector with the sizes information.
sys = simsizes(sizes);
%
x0 = []; % No continuous states
%
str = []; % No state ordering
%
ts = [-1 0]; % Inherited sample time
% End of mdlInitializeSizes.
%==============================================================
% Function mdlOutputs performs the calculations.
%==============================================================
function sys = mdlOutputs(t,x,u)
sys = 2*u;
% End of mdlOutputs.
标签:irf handle cti patch tin mes through format info
原文地址:https://www.cnblogs.com/franksimon/p/13231279.html