?? demodpsk_f.sci
字號:
//DEMODPSK_f Scicos demodulator MPSK block
//Classical interface function ver1.0 - scilab-3
//25 octobre 2003 Author : - IRCOM GROUP - A.Layec
function [x,y,typ]=DEMODPSK_f(job,arg1,arg2)
x=[];y=[];typ=[]
select job
case 'plot' then
nb=arg1.model.ipar;
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,nb,herit,exprs]=getvalue('Set M-ary Phase Shift Keying demodulator block',...
['Number of states';'Accept herited events 0/1'],...
list('vec',-1,'vec',1),exprs);
if ~ok then break,end;
//teste si le nombre d'閠at est entier
if ~is_int(nb) then
message('The number of states must be integer.')
ok=%F
end
nu=size(nb,'*')
if ok then
if herit==1 then
model.dep_ut=[%t %f]
[model,graphics,ok]=check_io(model,graphics,[nu;nu],nu,[],[])
else
model.dep_ut=[%f %f]
[model,graphics,ok]=check_io(model,graphics,[nu;nu],nu,1,[])
end
graphics.exprs=exprs;
model.ipar=nb(:);
if size(nb,'*')<>1 then
graphics.id=[" M - PSK";"Demodulator"];
else
graphics.id=[" "+string(evstr(nb(1)))+" - PSK";"Demodulator"];
end
x.graphics=graphics; x.model=model;
break;
end
end
case 'define' then
nb=4
nu=1
herit=1
model=scicos_model()
model.sim=list('demodpsk',4)
model.in=[nu;nu]
model.out=nu
model.evtin=[]
model.evtout=[]
model.dstate=[]
model.rpar=[]
model.ipar=nb
model.blocktype='d'
model.firing=[]
model.dep_ut=[%t %f]
gr_i=['thick=xget(''thickness'')'
'pat=xget(''pattern'')'
'fnt=xget(''font'')'
'ln_st=xget(""line style"")'
'sz1=0.86*sz(1);sz2=0.86*sz(2)'
'xxs=orig(1)+sz(1)/2';
'yys=orig(2)+sz(2)/2';
'if nb(1)<16 then'
' ww=0.14*sz(1)'
' hh=0.14*sz(2)'
' eps_deg=10'
'elseif nb(1)>=32 then'
' ww=0.06*sz(1)'
' hh=0.06*sz(2)'
' eps_deg=4'
'else'
' ww=0.1*sz(1)'
' hh=0.1*sz(2)'
' eps_deg=7'
'end'
'aa1=0'
'aa2=64*360'
'xset(""line style"",2)'
'for ii=1:nb(1)'
' phi(ii)=%pi*((2*(ii-1)+1)/nb(1))'
'end'
'phi_deg=phi*180/%pi'
'for ii=1:nb(1)'
' phi_b=phi_deg(ii)'
' if ii<nb(1) then'
' phi_e=phi_deg(ii+1)'
' else'
' phi_e=phi_deg(1)+360'
' end'
' phi_d=phi_e-phi_b'
' xarc(xxs-sz1/2,yys+sz2/2,sz1,sz2,(phi_b+eps_deg)*64,(phi_d-2*eps_deg)*64)'
'end'
'xset(""line style"",ln_st)'
'clear phi'
'for ii=1:nb(1)'
' phi=%pi*((2*(ii-1)+1)/nb(1))'
' aa=cos(phi);bb=sin(phi)'
' xxx=xxs+sz1/2*aa-ww/2'
' yyy=yys+sz2/2*bb+hh/2'
' xfarc(xxx,yyy,ww,hh,aa1,aa2)'
'end'
'xpoly([xxs;xxs],[orig(2);orig(2)+sz(2)],""lines"")'
'xpoly([orig(1);orig(1)+sz(2)],[yys;yys],""lines"")'
'xset(''thickness'',thick)'
'xset(''pattern'',pat)'
'xset(''font'',fnt(1),fnt(2))'
]
exprs=[sci2exp(nb),string(herit)]
x=standard_define([2 2],model,exprs,gr_i)
x.graphics.id=[" M - PSK";"Demodulator"];
end
endfunction
//X est une matrice de r閑ls
//tt est un boolean
function tt=is_int(X)
Y=matrix(X,size(X,'*'),1);
Z=int(X);
tt=%t;
for i=1:size(Y,1)
if (Z(i)-Y(i))<>0 then
tt=tt&%f;
else
tt=tt&%t;
end
end
endfunction
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -