📄 comp_f.sci
字号:
//COMP_f Scicos 1 bit Quantizer block
//Classical interface function - scilab-3
//IRCOM GROUP - A.Layec
//REV HISTORY
//$Log$
function [x,y,typ]=COMP_f(job,arg1,arg2)
x=[];y=[];typ=[]
select job
case 'plot' then
standard_draw(arg1)
case 'getinputs' then
[x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
[x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
[x,y]=standard_origin(arg1)
case 'set' then
x=arg1;
graphics=arg1.graphics;model=arg1.model;
exprs=graphics.exprs;
while %t do
[ok,nu,ampl,herit,exprs]=getvalue('Scicos one bit comparator block',...
['Size of input vector';'Amplitude of outputs';'Accepted herited (0/1)?'],...
list('vec',1,'vec',-1,'vec',1),exprs);
if ~ok then break,end;
if (size(ampl,'*')<>1)&(nu<>size(ampl,'*')) then
message("Parameter Amplitude of outputs must have a size equal to 1 or equal to size of input vector");
else
if ok then
//nu=size(ampl,'*')
if herit==1 then
model.dep_ut=[%t %f]
[model,graphics,ok]=check_io(model,graphics,nu,nu,[],[])
else
model.dep_ut=[%f %f]
[model,graphics,ok]=check_io(model,graphics,nu,nu,1,[])
end
graphics.exprs=exprs;
model.in=nu
model.out=nu
model.rpar=ampl(:)
x.graphics=graphics; x.model=model;
break;
end
end
end
case 'define' then
ampl=1
//nu=size(ampl,'*')
nu=1
herit=1
model=scicos_model()
model.sim=list('comp',4)
model.in=nu
model.out=nu
model.evtin=[]
model.evtout=[]
model.dstate=[]
model.rpar=ampl(:)
model.ipar=[]
model.blocktype='d'
model.firing=[]
model.dep_ut=[%t %f]
gr_i=['thick=xget(''thickness'')'
'pat=xget(''pattern'')'
'fnt=xget(''font'')'
'xset(''thickness'',2)'
'xpoly(orig(1)+[0.704;0.410;0.410;0.107]*sz(1),orig(2)+[0.862;0.862;0.151;0.151]*sz(2),"'lines"')'
'xpoly(orig(1)+[0.264;0.589]*sz(1),orig(2)+[0.503;0.503]*sz(2),"'lines"')'
'xset(''thickness'',thick)'
'xset(''pattern'',pat)'
'xset(''font'',fnt(1),fnt(2))'
]
exprs=[string(nu),string(ampl),string(herit)];
x=standard_define([2 2],model,exprs,gr_i)
x.graphics.id="1-bit quantizer"
end
endfunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -