📄 sfunmem.m
字号:
function [sys, x0] = sfunmem(t,x,u,flag)
%SFUNMEM A one integration-step memory block S-function.
%
% This M-file is designed to be used in a SIMULINK S-Function block.
% It performs a one integration-step delay and hold "memory" function.
% Thus, no matter how large or small the last time increment was in the
% integration process, this function will hold the input variable from
% the last integration step.
%
% Use this function with a clock as input to get the step-size
% of the simulation.
%
% Copyright (c) 1990-94 by The MathWorks, Inc.
% Ned Gulley 2-19-92
if abs(flag) == 2,
% If flag == 2, then SIMULINK is looking for the next point in real time.
% current state x gets current input u
sys = u;
elseif flag == 3,
% If flag == 3, then SIMULINK wants to know what the next output is.
% current output y gets current state x
sys = x;
elseif flag == 0,
% This part takes care of all initialization; it is used only once.
% The system has only one discrete state, output, and input.
% Significantly, this system has no direct feedthrough
disp('Warning: The memory block should be replaced with a newer version.')
disp(' This can be found in the SIMULINK block library under Nonlinear.')
x0 = 0;
sys = [0 1 1 1 0 0]';
else
% Flags not considered here are treated as unimportant.
% Output is set to [].
sys = [];
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -