📄 sb2slsft.m
字号:
function sb2slsft(blkname,in,fl,cod,timer)
%SB2SLSFT converts shift register blocks to SIMULINK.
% SB2SLSFT(BLKNAME,IN,FL,COD,TIMER) converts a SystemBuild block
% to a SIMULINK block. BLKNAME is a string containing the name of
% the block. The parameters are set up for this block based on the
% SystemBuild file coding integer IN and real number FL.
%
% COD is a three dimensional vector. The first element indicates
% whether it is a continuous (0) or discrete (1) time system.
% The second element indicates whether it does not need (0) or
% does need (1) a mask. The third element indicates the
% orientation of the block.
%
% TIMER is designed for discrete time only. The first element of
% TIMER is the sampling time. The second element is the initial time.
% shift register 11:2, only happens in discrete time case
% Wes Wang 11/17/92
% Copyright (c) 1990-93 by The MathWorks, Inc.
% $Revision: 1.7 $ $Date: 1993/06/09 22:09:40 $
T=ones(1,in(6))*timer(1);
x0 = zeros(1,in(6));
if in(28) >0
for i=1:in(29)
x0(in(in(29)+29+i)) = fl(i);
end;
end;
set_param(blkname,'Location',[0,150,300+in(6)*70,322])
set_param([blkname '/input1'],'position',[55,60,75,80])
temp = 'input1/1';
for i=1:in(6)
add_block('built-in/Unit Delay',[blkname '/Unit Delay' num2str(i)])
set_param([blkname '/Unit Delay' num2str(i)],...
'x0',['x0(' num2str(i) ')'],...
'Sample time',['T(' num2str(i) ')'],...
'position',[20+80*i,60,80*i+60,80])
temp2 = ['Unit Delay' num2str(i) '/1'];
autoline(blkname, temp, temp2);
if (in(6)-i) < in(5)
%locate outport
set_param([blkname '/output' num2str(in(6)-i+1)],...
'Port',num2str(in(6)-i+1),...
'position',[20+80*(i+1),105,40+80*(i+1),125])
autoline(blkname,temp2,['output' num2str(in(6)-i+1) '/1']);
end;
temp = temp2;
end;
set_param(blkname,...
'Mask Display','Shift\nRegister',...
'Mask Type','Shift Register',...
'Mask Dialogue','Shift register.|Initail conditions:|sampling time',...
'Mask Translate','x0=@1;T=@2;')
set_param(blkname,...
'Mask Help','REGISTER SHIFT Sequencially shift register at given time Sampling time delay. Unmask to see detail.')
set_param(blkname,...
'Mask Entries',[mat2str(x0) '\/' mat2str(T) '\/'])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -