Mercurial > octave-nkf
annotate doc/interpreter/sparseimages.m @ 11039:4cbb08163a1f
Use Octave to create pdf versions of plots for documentation.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 28 Sep 2010 19:22:01 -0700 |
parents | d9c8916bb9dd |
children | fd0a3ac60b0e |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 2006, 2007, 2008 David Bateman |
7018 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
6126 | 19 function sparseimages (nm, typ) |
11039
4cbb08163a1f
Use Octave to create pdf versions of plots for documentation.
Rik <octave@nomad.inbox5.com>
parents:
11033
diff
changeset
|
20 backend ("gnuplot"); |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
21 set_print_size (); |
7257 | 22 if (strcmp (typ, "png")) |
23 set (0, "defaulttextfontname", "*"); | |
24 endif | |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
25 |
6040 | 26 if (! isempty (findstr (octave_config_info ("DEFS"), "HAVE_COLAMD")) |
27 && ! isempty (findstr (octave_config_info ("DEFS"), "HAVE_CHOLMOD")) | |
28 && ! isempty (findstr (octave_config_info ("DEFS"), "HAVE_UMFPACK"))) | |
6126 | 29 if (strcmp(typ,"txt")) |
30 txtimages (nm, 15, typ); | |
6003 | 31 else |
6126 | 32 if (strcmp (nm, "gplot")) |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
33 gplotimages ("gplot", typ); |
6126 | 34 elseif (strcmp (nm, "grid")) |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
35 femimages ("grid", typ); |
6126 | 36 else |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
37 otherimages (nm, 200, typ); |
6126 | 38 endif |
6003 | 39 endif |
6040 | 40 else ## There is no sparse matrix implementation available because |
41 ## of missing libraries, plot sombreros instead | |
42 sombreroimage (nm, typ); | |
43 endif | |
6003 | 44 endfunction |
45 | |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
46 function set_print_size () |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
47 image_size = [5.0, 3.5]; # in inches, 16:9 format |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
48 border = 0; # For postscript use 50/72 |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
49 set (0, "defaultfigurepapertype", "<custom>"); |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
50 set (0, "defaultfigurepaperorientation", "landscape"); |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
51 set (0, "defaultfigurepapersize", image_size + 2*border); |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
52 set (0, "defaultfigurepaperposition", [border, border, image_size]); |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
53 endfunction |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
54 |
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
55 function hide_output () |
6257 | 56 f = figure (1); |
57 set (f, "visible", "off"); | |
6003 | 58 endfunction |
59 | |
6040 | 60 function gplotimages (nm, typ) |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
61 hide_output (); |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
62 if (strcmp (typ, "eps")) |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
63 d_typ = "-depsc2"; |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
64 else |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
65 d_typ = cstrcat ("-d", typ); |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
66 endif |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
67 |
6040 | 68 A = sparse ([2,6,1,3,2,4,3,5,4,6,1,5], |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
69 [1,1,2,2,3,3,4,4,5,5,6,6], 1, 6, 6); |
6003 | 70 xy = [0,4,8,6,4,2;5,0,5,7,5,7]'; |
6040 | 71 gplot (A, xy) |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
72 print (cstrcat (nm, ".", typ), d_typ) |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
73 hide_output (); |
6003 | 74 endfunction |
75 | |
11039
4cbb08163a1f
Use Octave to create pdf versions of plots for documentation.
Rik <octave@nomad.inbox5.com>
parents:
11033
diff
changeset
|
76 function txtimages(nm, n, typ) |
6003 | 77 a = 10*speye(n) + sparse(1:n,ceil([1:n]/2),1,n,n) + ... |
78 sparse(ceil([1:n]/2),1:n,1,n,n); | |
79 if (strcmp (nm, "gplot") || strcmp (nm, "grid")) | |
80 fid = fopen (sprintf ("%s.txt", nm), "wt"); | |
7256 | 81 fputs (fid, "\n"); |
6003 | 82 fputs (fid, "+---------------------------------+\n"); |
83 fputs (fid, "| Image unavailable in text mode. |\n"); | |
84 fputs (fid, "+---------------------------------+\n"); | |
85 fclose (fid); | |
86 elseif (strcmp (nm, "spmatrix")) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7262
diff
changeset
|
87 printsparse(a,cstrcat("spmatrix.",typ)); |
6003 | 88 else |
89 if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && | |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
90 !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD"))) |
6003 | 91 if (strcmp (nm, "spchol")) |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
92 r1 = chol(a); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
93 printsparse(r1,cstrcat("spchol.",typ)); |
6003 | 94 elseif (strcmp (nm, "spcholperm")) |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
95 [r2,p2,q2]=chol(a); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
96 printsparse(r2,cstrcat("spcholperm.",typ)); |
6003 | 97 endif |
98 ## printf("Text NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2)); | |
99 endif | |
100 endif | |
101 endfunction | |
102 | |
11039
4cbb08163a1f
Use Octave to create pdf versions of plots for documentation.
Rik <octave@nomad.inbox5.com>
parents:
11033
diff
changeset
|
103 function otherimages(nm, n, typ) |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
104 hide_output (); |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
105 if (strcmp (typ, "eps")) |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
106 d_typ = "-depsc2"; |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
107 else |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
108 d_typ = cstrcat ("-d", typ); |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
109 endif |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
110 |
6003 | 111 a = 10*speye(n) + sparse(1:n,ceil([1:n]/2),1,n,n) + ... |
112 sparse(ceil([1:n]/2),1:n,1,n,n); | |
113 if (strcmp (nm, "spmatrix")) | |
114 spy(a); | |
115 axis("ij") | |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
116 print(cstrcat("spmatrix.",typ), d_typ) |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
117 hide_output (); |
6003 | 118 else |
119 if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && | |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
120 !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD"))) |
6003 | 121 if (strcmp (nm, "spchol")) |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
122 r1 = chol(a); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
123 spy(r1); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
124 axis("ij") |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
125 print(cstrcat("spchol.",typ), d_typ) |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
126 hide_output (); |
6003 | 127 elseif (strcmp (nm, "spcholperm")) |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
128 [r2,p2,q2]=chol(a); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
129 spy(r2); |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
130 axis("ij") |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
131 print(cstrcat("spcholperm.",typ), d_typ) |
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
132 hide_output (); |
6003 | 133 endif |
134 ## printf("Image NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2)); | |
135 endif | |
136 endif | |
137 endfunction | |
138 | |
11039
4cbb08163a1f
Use Octave to create pdf versions of plots for documentation.
Rik <octave@nomad.inbox5.com>
parents:
11033
diff
changeset
|
139 function printsparse(a, nm) |
6003 | 140 fid = fopen (nm,"wt"); |
7256 | 141 fputs (fid, "\n"); |
6003 | 142 for i = 1:size(a,1) |
143 if (rem(i,5) == 0) | |
144 fprintf (fid," %2d - ", i); | |
145 else | |
146 fprintf (fid," | "); | |
147 endif | |
148 for j = 1:size(a,2) | |
149 if (a(i,j) == 0) | |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
150 fprintf(fid," ") |
6003 | 151 else |
11033
d9c8916bb9dd
Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents:
9914
diff
changeset
|
152 fprintf(fid," *") |
6003 | 153 endif |
154 endfor | |
155 fprintf(fid,"\n") | |
156 endfor | |
157 fprintf(fid," |-"); | |
158 for j=1:size(a,2) | |
159 if (rem(j,5)==0) | |
160 fprintf(fid,"-|"); | |
161 else | |
162 fprintf(fid,"--"); | |
163 endif | |
164 endfor | |
165 fprintf(fid,"\n") | |
166 fprintf(fid," "); | |
167 for j=1:size(a,2) | |
168 if (rem(j,5)==0) | |
169 fprintf(fid,"%2d",j); | |
170 else | |
171 fprintf(fid," "); | |
172 endif | |
173 endfor | |
174 fclose(fid); | |
175 endfunction | |
176 | |
11039
4cbb08163a1f
Use Octave to create pdf versions of plots for documentation.
Rik <octave@nomad.inbox5.com>
parents:
11033
diff
changeset
|
177 function femimages (nm, typ) |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
178 hide_output (); |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
179 if (strcmp (typ, "eps")) |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
180 d_typ = "-depsc2"; |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
181 else |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
182 d_typ = cstrcat ("-d", typ); |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
183 endif |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
184 |
6003 | 185 if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && |
186 !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD")) && | |
187 !isempty(findstr(octave_config_info ("DEFS"),"HAVE_UMFPACK"))) | |
188 ## build a rectangle | |
189 node_y = [1;1.2;1.5;1.8;2]*ones(1,11); | |
190 node_x = ones(5,1)*[1,1.05,1.1,1.2,1.3,1.5,1.7,1.8,1.9,1.95,2]; | |
191 nodes = [node_x(:), node_y(:)]; | |
192 | |
193 [h,w] = size(node_x); | |
194 elems = []; | |
195 for idx = 1:w-1 | |
196 widx = (idx-1)*h; | |
197 elems = [elems; widx+[(1:h-1);(2:h);h+(1:h-1)]']; | |
198 elems = [elems; widx+[(2:h);h+(2:h);h+(1:h-1)]']; | |
199 endfor | |
200 | |
201 E = size(elems,1); #No. of elements | |
202 N = size(nodes,1); #No. of elements | |
203 D = size(elems,2); #dimentions+1 | |
204 | |
205 ## Plot FEM Geometry | |
206 elemx = elems(:,[1,2,3,1])'; | |
207 xelems = reshape( nodes(elemx, 1), 4, E); | |
208 yelems = reshape( nodes(elemx, 2), 4, E); | |
209 | |
210 ## Set element conductivity | |
211 conductivity = [1*ones(1,16),2*ones(1,48),1*ones(1,16)]; | |
212 | |
213 ## Dirichlet boundary conditions | |
214 D_nodes = [1:5, 51:55]; | |
215 D_value = [10*ones(1,5), 20*ones(1,5)]; | |
216 | |
217 ## Neumann boundary conditions | |
218 ## Note that N_value must be normalized by the boundary | |
219 ## length and element conductivity | |
220 N_nodes = []; | |
221 N_value = []; | |
222 | |
223 ## Calculate connectivity matrix | |
224 C = sparse((1:D*E), reshape(elems',D*E,1),1, D*E, N); | |
225 | |
226 ## Calculate stiffness matrix | |
227 Siidx = floor([0:D*E-1]'/D)*D*ones(1,D) + ones(D*E,1)*(1:D) ; | |
228 Sjidx = [1:D*E]'*ones(1,D); | |
229 Sdata = zeros(D*E,D); | |
230 dfact = prod(2:(D-1)); | |
231 for j = 1:E | |
232 a = inv([ ones(D,1), nodes( elems(j,:), : ) ]); | |
233 const = conductivity(j)*2/dfact/abs(det(a)); | |
234 Sdata(D*(j-1)+(1:D),:)= const * a(2:D,:)'*a(2:D,:); | |
235 endfor | |
236 | |
237 ## Element-wise system matrix | |
238 SE = sparse(Siidx,Sjidx,Sdata); | |
239 ## Global system matrix | |
240 S = C'* SE *C; | |
241 | |
242 ## Set Dirichlet boundary | |
243 V = zeros(N,1); | |
244 V(D_nodes) = D_value; | |
245 idx = 1:N; | |
246 idx(D_nodes) = []; | |
247 | |
248 ## Set Neumann boundary | |
249 Q = zeros(N,1); | |
250 Q(N_nodes) = N_value; # FIXME | |
251 | |
252 V(idx) = S(idx,idx)\( Q(idx) - S(idx,D_nodes)*V(D_nodes) ); | |
253 | |
254 velems = reshape( V(elemx), 4, E); | |
255 | |
256 sz = size(xelems,2); | |
6178 | 257 |
258 plot3 (xelems, yelems, velems); | |
6257 | 259 view (10, 10); |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
260 print(cstrcat(nm,".",typ), d_typ) |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
261 hide_output (); |
6003 | 262 endif |
263 endfunction | |
6040 | 264 |
265 ## There is no sparse matrix implementation available because of missing | |
266 ## libraries, plot sombreros instead. Also plot a nice title that we are | |
267 ## sorry about that. | |
268 function sombreroimage (nm, typ) | |
269 if (strcmp (typ, "txt")) | |
270 fid = fopen (sprintf ("%s.txt", nm), "wt"); | |
7256 | 271 fputs (fid, "\n"); |
6040 | 272 fputs (fid, "+---------------------------------------+\n"); |
273 fputs (fid, "| Image unavailable because of a |\n"); | |
274 fputs (fid, "| missing sparse matrix implementation. |\n"); | |
275 fputs (fid, "+---------------------------------------+\n"); | |
276 fclose (fid); | |
277 return; | |
278 else ## if (!strcmp (typ, "txt")) | |
279 | |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
280 hide_output (); |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
281 if (strcmp (typ, "eps")) |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
282 d_typ = "-depsc2"; |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
283 else |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
284 d_typ = cstrcat ("-d", typ); |
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
285 endif |
6040 | 286 |
287 x = y = linspace (-8, 8, 41)'; | |
288 [xx, yy] = meshgrid (x, y); | |
289 r = sqrt (xx .^ 2 + yy .^ 2) + eps; | |
290 z = sin (r) ./ r; | |
291 unwind_protect | |
6257 | 292 mesh (x, y, z); |
11039
4cbb08163a1f
Use Octave to create pdf versions of plots for documentation.
Rik <octave@nomad.inbox5.com>
parents:
11033
diff
changeset
|
293 title ("Sorry, graphics are unavailable because Octave was\ncompiled without a sparse matrix implementation."); |
6040 | 294 unwind_protect_cleanup |
9914
e76d8c767584
Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents:
9912
diff
changeset
|
295 print (cstrcat (nm, ".", typ), d_typ); |
9912
e9fe12c1b0c0
Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
296 hide_output (); |
6040 | 297 end_unwind_protect |
298 endif | |
299 endfunction | |
7262 | 300 |
301 ## generate something for the texinfo @image command to process | |
302 function image_as_txt(nm) | |
303 fid = fopen (sprintf ("%s.txt", nm), "wt"); | |
304 fputs (fid, "\n"); | |
305 fputs (fid, "+---------------------------------+\n"); | |
306 fputs (fid, "| Image unavailable in text mode. |\n"); | |
307 fputs (fid, "+---------------------------------+\n"); | |
308 fclose (fid); | |
309 endfunction |