~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/Linear/VARIABLE_DELAY.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [x,y,typ]=VARIABLE_DELAY(job,arg1,arg2)
 
2
// Copyright INRIA
 
3
x=[];y=[];typ=[];
 
4
select job
 
5
case 'plot' then //normal  position 
 
6
  standard_draw(arg1)
 
7
case 'getinputs' then
 
8
  [x,y,typ]=standard_inputs(arg1)
 
9
case 'getoutputs' then
 
10
  [x,y,typ]=standard_outputs(arg1)
 
11
case 'getorigin' then
 
12
  [x,y]=standard_origin(arg1)
 
13
case 'set' then
 
14
  x=arg1;
 
15
  graphics=arg1.graphics;exprs=graphics.exprs
 
16
  model=arg1.model;nin=model.in(1)
 
17
 
 
18
   while %t do
 
19
    [ok,T,init,N,exprs]=getvalue('Set delay parameters',..
 
20
        ['Max delay';'initial input';'Buffer size'],..
 
21
        list('vec',1,'vec',1,'vec',1),..
 
22
        exprs);
 
23
    if ~ok then break,end
 
24
    if N<2 then 
 
25
      message('Buffer must be larger than 2')
 
26
      ok=%f
 
27
    end 
 
28
    if T<=0 then
 
29
      message('Delay must be positive')
 
30
      ok=%f
 
31
    end
 
32
   
 
33
   if ok then
 
34
      [model,graphics,ok]=check_io(model,graphics,[-1;1],-1,[],[])
 
35
   end     
 
36
    if ok then
 
37
      graphics.exprs=exprs;
 
38
      model.rpar=[T;init];
 
39
      model.ipar=N
 
40
      x.graphics=graphics;x.model=model
 
41
      break
 
42
    end
 
43
  end
 
44
case 'define' then
 
45
  nin=1
 
46
  T=1
 
47
  init=0
 
48
  N=1024
 
49
  model=scicos_model()
 
50
  model.sim=list('variable_delay',4)
 
51
  model.in=[nin;1]
 
52
  model.out=nin
 
53
  model.rpar=[T,init];
 
54
  model.ipar=N
 
55
  model.blocktype='d'
 
56
  model.dep_ut=[%t %f]
 
57
 
 
58
  exprs=[string(T);string(init);string(N)];
 
59
  gr_i=['txt=[''Variable'';''delay''];';
 
60
        'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
 
61
  x=standard_define([2.5 2.5],model,exprs,gr_i)
 
62
end
 
63
endfunction