📄 gengold_f.sci
字号:
//GENGOLD_f Scicos Gold Sequences Generator block
//Classical interface function ver1.0 - scilab-2.7&3.0
//15 dec 2004 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=GENGOLD_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,ny,long,ci1,ci2,coef1,coef2,delay,exprs]=getvalue('Gold Sequence generator',...
['Vector of Size of outputs';...
'Vector of Length of register';...
'Vector of Initial condition register 1';...
'Vector of Initial condition register 2';...
'Vector of coefficients register 1';...
'Vector of coefficients register 2'
'Initial Delay'],...
list('vec',-1,'vec',-1,'vec',-1,'vec',-1,'vec',-1,'vec',-1,'vec',1),exprs);
if ~ok then break,end;
Nu=size(long,'*')
if ((size(long)==size(ny))&(size(long)==size(ci1))&(size(long)==size(coef1))&(size(long)==size(ci2))&(size(long)==size(coef2))) then
if ok then
graphics.exprs=exprs;
model.out=sum(ny)
model.dstate=[ci1(:);ci2(:)]
ipar = [Nu;ny(:);long(:);coef1(:);coef2(:)]
model.ipar=ipar(:)
model.rpar=delay
x.graphics=graphics; x.model=model
break
end
else
message('All parameters must have the same size');
end
end
case 'define' then
ny=(2^5)-1
Nu=1
long=5
ci1=21
ci2=13
coef1=9
coef2=15
delay=0
model=scicos_model()
model.sim=list('gengold',4)
model.in=[]
model.out=ny
model.evtin=1
model.evtout=[]
model.dstate=[ci1(:);ci2(:)]
model.rpar=delay
model.ipar=[Nu;ny;long;coef1;coef2]
model.blocktype='d'
model.firing=[]
model.dep_ut=[%f %f]
gr_i=['txt=['' Gold'';''Generator''];';
'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
exprs=[sci2exp(ny),sci2exp(long),sci2exp(ci1),sci2exp(ci2),sci2exp(coef1),sci2exp(coef2),sci2exp(delay)];
x=standard_define([2 2],model,exprs,gr_i)
end
endfunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -