~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/DLR_f.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [x,y,typ]=DLR_f(job,arg1,arg2)
 
2
// Copyright INRIA
 
3
x=[];y=[];typ=[]
 
4
select job
 
5
case 'plot' then
 
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(2);label=graphics(4)
 
16
  model=arg1(3);
 
17
  x0=model(7);ns=prod(size(x0));
 
18
  z=poly(0,'z')
 
19
  while %t do
 
20
    [ok,num,den,label]=getvalue('Set discrete SISO transfer parameters',..
 
21
        ['Numerator (z)';
 
22
         'Denominator (z)'],..
 
23
        list('pol',1,'pol',1),label)
 
24
    if ~ok then break,end
 
25
    if degree(num)>degree(den) then
 
26
      message('Transfer must be proper')
 
27
      ok=%f
 
28
    end
 
29
    if ok then
 
30
      H=cont_frm(num,den)
 
31
      [A,B,C,D]=H(2:5);
 
32
      graphics(4)=label;
 
33
      [ns1,ns1]=size(A)
 
34
      if ns1<=ns then
 
35
        x0=x0(1:ns1)
 
36
      else
 
37
        x0(ns1,1)=0
 
38
      end
 
39
      rpar=[A(:);
 
40
            B(:);
 
41
            C(:);
 
42
            D(:)]
 
43
      model(7)=x0
 
44
      model(8)=rpar
 
45
      if norm(D,1)<>0 then
 
46
        mmm=[%t %f];
 
47
      else
 
48
        mmm=[%f %f];
 
49
      end
 
50
      if or(model(12)<>mmm) then 
 
51
          model(12)=mmm,end
 
52
      x(2)=graphics;x(3)=model
 
53
      break
 
54
    end
 
55
  end
 
56
  x(3)(11)=[] //compatibility
 
57
case 'define' then
 
58
  x0=0;A=-1;B=1;C=1;D=0;
 
59
  label=['1';'1+z']
 
60
  model=list('dsslti',1,1,1,[],[],x0(:),[A;B;C;D],[],'d',[],[%f %f],' ',list())
 
61
  gr_i=['txt=[''Num(z)'';''-----'';''Den(z)''];';
 
62
    'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
 
63
  x=standard_define([2.5 2.5],model,label,gr_i)
 
64
end
 
65
 
 
66
 
 
67
 
 
68
 
 
69
 
 
70