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

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/NonLinear/INTRPLBLK_f.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]=INTRPLBLK_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.graphics;exprs=graphics.exprs
 
16
  model=arg1.model;
 
17
  while %t do
 
18
    [ok,a,b,exprs]=getvalue('Set Interpolation block parameters',..
 
19
        ['X coord.';'Y coord.'],list('vec',-1,'vec',-1),exprs)
 
20
    if ~ok then break,end
 
21
    if size(a,'*') <> size(b,'*') then
 
22
      message('X and Y must have the same size')
 
23
    elseif min(a(2:$)-a(1:$-1)) <=0 then
 
24
      message('X must be strictly increasing')
 
25
    else
 
26
      if ok then
 
27
        graphics.exprs=exprs
 
28
        model.rpar=[a(:);b(:)]
 
29
        x.graphics=graphics;x.model=model
 
30
        break
 
31
      end
 
32
    end
 
33
  end
 
34
case 'define' then
 
35
  a=[0;1];b=[0;1]
 
36
  model=scicos_model()
 
37
  model.sim='intrpl'
 
38
  model.in=1
 
39
  model.out=1
 
40
  model.rpar=[a;b]
 
41
  model.blocktype='c'
 
42
  model.dep_ut=[%t %f]
 
43
 
 
44
  exprs=[strcat(sci2exp(a));strcat(sci2exp(b))]
 
45
  gr_i=['xstringb(orig(1),orig(2),''interp'',sz(1),sz(2),''fill'');']
 
46
  x=standard_define([2 2],model,exprs,gr_i)
 
47
end
 
48
endfunction