Interfacing function
eng


NOISERAYL_c

File content


//NOISERAYL_c Scicos Rayleigh Random Generator
//Classical interface function ver1.0 - scilab-4.1.2
//5 decembre 2007  Author : - INRIA - A.Layec
function [x,y,typ]=NOISERAYL_c(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 Scicos Rayleigh Noise Generator']
      [ok,nmy,sig,seed,exprs]=getvalue(text,...
      ['Size of outputs';'sigma';'seed'],...
      list('mat',[1 2],'vec',1,'vec',1),exprs)

      if ~ok then break,end;

      if ok then
          graphics.exprs=exprs
          [model,graphics,ok]=set_io(model,graphics,list([],[]),list(nmy,1),1,[])

          model.dstate=[]
          model.ipar=[int(seed)]
          model.rpar=[sig(:)]
          x.graphics=graphics;x.model=model
          break;
      end
   end

case 'define' then
  nmy=[64,1]
  sig=0.5
  seed=int(rand()*1e8)

  model=scicos_model()
  model.sim=list('noiseraylblk',4)
  model.in=[]
  model.out=nmy(1);
  model.out2=nmy(1);
  model.evtin=[1]
  model.evtout=[]
  model.dstate=[]
  model.rpar=[sig(:)]
  model.ipar=[seed]
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%f %f]

  gr_i=['txt=[''Random'';''Generator''];';
        'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');'
        'xset(''font'',5,1)'
        'txt=''Rayleigh'';'
        'style=5;'
        'rectstr=stringbox(txt,orig(1),orig(2),0,style,1);'
        'w=(rectstr(1,3)-rectstr(1,2))*%zoom;'
        'h=(rectstr(2,2)-rectstr(2,4))*%zoom;'
        'xstringb(orig(1)+sz(1)/2-w/2,orig(2)-h-4,txt,w,h,''fill'');'
        'e=gce();'
        'e.font_style=style;']
  exprs=[sci2exp(nmy),string(sig),string('int(rand()*1e8)')]
  x=standard_define([2 2],model,exprs,gr_i)
end
endfunction