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

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/Sources/RAMP.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]=RAMP(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.graphics;exprs=graphics.exprs
 
16
  model=arg1.model;
 
17
  while %t do
 
18
    [ok,slope,stt,iout,exprs]=getvalue('Set ramp parameters',..
 
19
        ['Slope';'Start time';'Initial output'],list('vec',1,'vec',1,'vec',1),exprs)
 
20
    if ~ok then break,end
 
21
    if stt<0  then
 
22
      message('Time must be > 0')
 
23
    else
 
24
      model.rpar=[slope;stt;iout];
 
25
      graphics.exprs=exprs
 
26
      x.graphics=graphics;x.model=model
 
27
      break
 
28
    end
 
29
  end
 
30
case 'define' then
 
31
  slope=0;iout=0;stt=0;rpar=[slope;stt;iout];
 
32
  model=scicos_model()
 
33
  model.sim=list('ramp',4)
 
34
  model.in=[]
 
35
  model.out=1
 
36
  model.rpar=rpar
 
37
  model.blocktype='c'
 
38
  model.nmode=1
 
39
  model.nzcross=1
 
40
  model.dep_ut=[%f %t]
 
41
  
 
42
  exprs=[string(rpar)]
 
43
  gr_i=['thick=xget(''thickness'');xset(''thickness'',2);';
 
44
    'xx=orig(1)+[4/5;3/5;2/5]*sz(1);';
 
45
    'yy=orig(2)+[4/5;1/2;1/2]*sz(2);';
 
46
    'xpoly(xx,yy,''lines'');';
 
47
    'xset(''thickness'',thick)']
 
48
  x=standard_define([2 2],model,exprs,gr_i)
 
49
end
 
50
endfunction