AWGN_f
//AWGN_f Scicos Additive White Gaussian Noise block
//Classical interface function ver1.0 - scilab-3.0
//19 janvier 2005 Author : - IRCOM GROUP - A.Layec
function [x,y,typ]=AWGN_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
text=['Set Additive White Gaussian Noise Channel Block']
[ok,nu,sig,moy,herit,exprs]=getvalue(text,...
['Size of inputs';'Sigma';'Mean';'Inherit (no:0, yes:1)'],...
list('vec',1,'vec',1,'vec',1,'vec',1),exprs)
if ~ok then break,end;
if ok then
if herit==1 then
[model,graphics,ok]=check_io(model,graphics,[nu;nu],[nu;nu],[],[])
model.evtin=[]
else
[model,graphics,ok]=check_io(model,graphics,[nu;nu],[nu;nu],1,[])
model.evtin=1
end
model.in=[nu;nu]
model.out=[nu;nu]
graphics.exprs=exprs
model.rpar=[sig;moy]
x.graphics=graphics;x.model=model
break;
end
end
case 'define' then
nu=64;
sig=0;
moy=0
herit=1;
model=scicos_model()
model.sim=list('awgn',4)
model.in=[nu;nu]
model.out=[nu;nu]
model.dstate=[0;0]
model.evtin=[]
model.evtout=[]
model.rpar=[sig;moy]
model.ipar=[]
model.blocktype='d'
model.firing=[]
model.dep_ut=[%f %f %f]
gr_i=['txt=[''A.W.G.N.''];';
'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');'
]
exprs=[string(nu),string(sig),string(moy),string(herit)]
x=standard_define([2 2],model,exprs,gr_i)
end
endfunction