File: mtlb_plot.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (128 lines) | stat: -rw-r--r-- 2,972 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
function h=mtlb_plot(X1,X2,X3,X4,X5,X6,X7,X8,X9)
// Copyright INRIA
h=[]
[lhs,rhs]=argn(0)

if rhs==1 then
  strf='061'
  mtlb_plt1(X1,'k-')
elseif rhs==2 then
  strf='061'
  if type(X2)==10 then
    mtlb_plt1(X1,X2)
  else   
    mtlb_plt2(X1,X2)
  end
elseif rhs==3&type(X3)==10 then
  strf='061'
  mtlb_plt2(X1,X2,X3)
else
  k=1
  kc=[],cstyl=[]
  while k<=rhs-1 
    kc=[kc;[k k+1]]
    if k+2>rhs then
      cstyl=[cstyl,'k-']
    else
      execstr('tp=type(X'+string(k+2)+')')
      if tp==10 then
        execstr('st=X'+string(k+2))
        cstyl=[cstyl,st]
        k=k+3
      else
        cstyl=[cstyl,'k-']
        k=k+2
      end
    end
  end
  nc=size(cstyl,'*')
  xmx=-10^20
  xmn=10^20
  ymx=-10^20
  ymn=10^20
  for k=1:nc
    kx=kc(k,1)
    ky=kc(k,2)
    execstr('xmx=max(xmx,max(X'+string(kx)+'))')
    execstr('xmn=min(xmn,min(X'+string(kx)+'))')
    execstr('ymx=max(ymx,max(X'+string(ky)+'))')
    execstr('ymn=min(ymn,min(X'+string(ky)+'))')
  end
  xsetech([0,0,1.0,1.0],[xmn,ymn,xmx,ymx])
  strf='001'
  for k=1:nc
    kx=kc(k,1)
    ky=kc(k,2)
    execstr('mtlb_plt2(X'+string(kx)+',X'+string(ky)+',cstyl(k))')
  end
end


function mtlb_plt1(X1,mtlb_style)
[lhs,rhs]=argn(0)
p=xget('pattern')
mclrs=['y','m','c','r','g','b','w','k']
sclrs=[33 ,22 ,17 ,5  ,11 ,12 ,33 ,1  ]
mltyp=['.','o','x','+','-','*',':','-.','--']
sltyp=[0  ,9  ,2,   1,  -1  3   -1  -1   -1]
clr=sclrs(find(part(mtlb_style,1)==mclrs))
ltyp=find(mltyp==part(mtlb_style,2:length(mtlb_style)))
if ltyp>0 then
  xset('pattern',clr)
  style=-ltyp
else
  style=clr
end
if norm(imag(X1),1)==0 then
  if min(size(X1))==1 then
    plot2d1('enn',0,X1(:),style,strf)
  else
    plot2d1('enn',0,X1,style*ones(1,size(X1,2)),strf)
  end
else
  if min(size(X1))==1 then
    plot2d(real(X1(:)),imag(X1(:)),style,strf)
  else
    plot2d(real(X1),imag(X1),style*ones(1,size(X1,2)),strf)
  end
end
xset('pattern',p)

function mtlb_plt2(X1,Y1,mtlb_style)
[lhs,rhs]=argn(0)
p=xget('pattern')
if rhs==3 then
  mclrs=['y','m','c','r','g','b','w','k']
  sclrs=[33 ,22 ,17 ,5  ,11 ,12 ,33 ,1  ]
  mltyp=['.','o','x','+','-','*',':','-.','--']
  sltyp=[0  ,9  ,2,   1,  -1  3   -1  -1   -1]
  clr=sclrs(find(part(mtlb_style,1)==mclrs))
  ltyp=sltyp(find(part(mtlb_style,2:length(mtlb_style))==mltyp))
  if ltyp>0 then
    xset('pattern',clr)
    style=-ltyp
  else
    style=clr
  end
else
  style=[]
end
[mx1,nx1]=size(X1)
[my1,ny1]=size(Y1)
if min(size(X1))==1&min(size(Y1))==1 then
  X1=X1(:);Y1=Y1(:)
  n=min(size(X1,1),size(Y1,1))
  if style==[] then style=1,end
  plot2d(X1(1:n),Y1(1:n),style,strf)
elseif min(size(X1))==1 then
  nx1=mx1*nx1
  if my1<>nx1&ny1==nx1 then Y1=Y1.', end
  if style==[] then style=1:size(Y1,2),else style=style*ones(1,size(Y1,2)),end
  plot2d1('onn',X1(:),Y1,style,strf)  
elseif min(size(Y1))==1 then
  if style==[] then style=1,end
  plot2d1('onn',X1(:),Y1,style*ones(1,size(Y1,2)),strf)  
else
  plot2d(X1,Y1,style*ones(1,size(Y1,2)),strf)
end
xset('pattern',p)