215
|
1 --- |
|
2 layout: page |
|
3 title: GNU Octave Version 3 |
|
4 permalink: NEWS-3.html |
|
5 --- |
|
6 |
|
7 ## Summary of important user-visible changes |
|
8 |
|
9 December 21, 2007 |
|
10 |
|
11 {% include release_news_select.md %} |
|
12 |
|
13 <ul> |
|
14 <li>Compatibility with Matlab graphics is much better. We now |
|
15 have some graphics features that work like Matlab's Handle |
|
16 Graphics (tm): |
|
17 <ul> |
|
18 <li> You can make a subplot and then use the print function to |
|
19 generate file with the plot.</li> |
|
20 |
|
21 <li> RGB line colors are supported if you use gnuplot 4.2. Octave |
|
22 can still use gnuplot 4.0, but there is no way to set arbitrary |
|
23 line colors with it when using the Matlab-style plot functions. |
|
24 There never was any way to do this reliably with older versions |
|
25 of gnuplot (whether run from Octave or not) since it only |
|
26 provided a limited set to choose from, and they were terminal |
|
27 dependent, so choosing color 1 with the X11 terminal would be |
|
28 different from color 1 with the PostScript terminal. Valid RGB |
|
29 colors for gnuplot 4.0 are the eight possible combinations of 0 |
|
30 and 1 for the R, G and B values. Invalid values are all mapped |
|
31 to the same color. |
|
32 <p> |
|
33 This also affects patch objects used in the bar, countour, meshc |
|
34 and surfc functions, where the bars and contours will be |
|
35 monochrome. A workaround for this is to type "colormap gmap40" |
|
36 that loads a colormap that in many cases will be adequate for |
|
37 simple bar and contour plots.</li> |
|
38 |
|
39 <li> You can control the width of lines using (for example): |
|
40 <pre> |
|
41 line (x, y, "linewidth", 4, "color", [1, 0, 0.5]); |
|
42 </pre> |
|
43 (this also shows the color feature).</li> |
|
44 |
|
45 <li> With gnuplot 4.2, image data is plotted with gnuplot and may be |
|
46 combined with other 2-d plot data.</li> |
|
47 |
|
48 <li> Lines for contour plots are generated with an Octave function, so |
|
49 contour plots are now 2-d plots instead of special 3-d plots, and |
|
50 this allows you to plot additional 2-d data on top of a contour |
|
51 plot.</li> |
|
52 |
|
53 <li> With the gnuplot "extended" terminals the TeX interpreter is |
|
54 emulated. However, this means that the TeX interpreter is only |
|
55 supported on the postscript terminals with gnuplot 4.0. Under |
|
56 gnuplot 4.2 the terminals aqua, dumb, png, jpeg, gif, pm, windows, |
|
57 wxt, svg and x11 are supported as well.</li> |
|
58 |
|
59 <li> The following plot commands are now considered obsolete and will |
|
60 be removed from a future version of Octave: |
|
61 <pre> |
|
62 __gnuplot_set__ |
|
63 __gnuplot_show__ |
|
64 __gnuplot_plot__ |
|
65 __gnuplot_splot__ |
|
66 __gnuplot_replot__ |
|
67 </pre> |
|
68 Additionally, these functions no longer have any effect on plots |
|
69 created with the Matlab-style plot commands |
|
70 (<tt>plot</tt>, <tt>line</tt>, <tt>mesh</tt>, <tt>semilogx</tt>, |
|
71 etc.). |
|
72 |
|
73 <li> Plot property values are not extensively checked. Specifying |
|
74 invalid property values may produce unpredictible results.</li> |
|
75 |
|
76 <li> Octave now sends data over the same pipe that is used to send |
|
77 commands to gnuplot. While this avoids the problem of |
|
78 cluttering /tmp with data files, it is no longer possible to use |
|
79 the mouse to zoom in on plots. This is a limitation of gnuplot, |
|
80 which is unable to zoom when the data it plots is not stored in |
|
81 a file. Some work has been done to fix this problem in newer |
|
82 versions of gnuplot (> 4.2.2). See for example, |
|
83 <a href="http://www.nabble.com/zooming-of-inline-data-tf4357017.html#a12416496">this thread</a> on the gnuplot development list. |
|
84 </ul></li> |
|
85 |
|
86 |
|
87 <li>The way Octave handles search paths has changed. Instead of |
|
88 setting the built-in variable <tt>LOADPATH</tt>, you must |
|
89 use <tt>addpath</tt>, <tt>rmpath</tt>, or <tt>path</tt> to |
|
90 manipulate the function search path. These functions will |
|
91 maintain <tt>"."</tt> at the head of the path, for compatibility |
|
92 with Matlab. |
|
93 <p> |
|
94 Leading, trailing or doubled colons are no longer special. |
|
95 Now, all elements of the search path are explicitly included in |
|
96 the path when Octave starts. To display the path, use |
|
97 the <tt>path</tt> function. |
|
98 <p> |
|
99 Path elements that end in <tt>//</tt> are no longer searched recursively. |
|
100 Instead, you may use addpath and the genpath function to add an |
|
101 entire directory tree to the path. For example, |
|
102 <pre> |
|
103 addpath (genpath ("~/octave")); |
|
104 </pre> |
|
105 will add ~/octave and all directories below it to the head of the |
|
106 path.</li> |
|
107 |
|
108 |
|
109 <li>Previous versions of Octave had a number of built-in variables to |
|
110 control warnings (for example, <tt>warn_divide_by_zero</tt>). These |
|
111 variables have been replaced by warning identifiers that are used |
|
112 with the warning function to control the state of warnings. |
|
113 <p> |
|
114 For example, instead of writing |
|
115 <pre> |
|
116 warn_divide_by_zero = false; |
|
117 </pre> |
|
118 to disable divide-by-zero warnings, you should write |
|
119 <pre> |
|
120 warning ("off", "Octave:divide-by-zero"); |
|
121 </pre> |
|
122 You may use the same technique in your own code to control |
|
123 warnings. For example, you can use |
|
124 <pre> |
|
125 warning ("My-package:phase-of-the-moon", |
|
126 "the phase of the moon could cause trouble today"); |
|
127 </pre> |
|
128 to allow users to control this warning using the |
|
129 <tt>"My-package:phase-of-the-moon"</tt> warning identifier. |
|
130 <p> |
|
131 You may also enable or disable all warnings, or turn them into |
|
132 errors: |
|
133 <pre> |
|
134 warning ("on", "all"); |
|
135 warning ("off", "all"); |
|
136 warning ("error", "Octave:divide-by-zero"); |
|
137 warning ("error", "all"); |
|
138 </pre> |
|
139 You can query the state of current warnings using |
|
140 <pre> |
|
141 warning ("query", ID) |
|
142 warning ("query") |
|
143 </pre> |
|
144 (only those warning IDs which have been explicitly set are |
|
145 returned). |
|
146 <p> |
|
147 A partial list and description of warning identifiers is available |
|
148 using |
|
149 <pre> |
|
150 help warning_ids |
|
151 </pre></li> |
|
152 |
|
153 |
|
154 <li>All built-in variables have been converted to functions. This |
|
155 change simplifies the interpreter and allows a consistent |
|
156 interface to internal variables for user-defined packages and the |
|
157 core functions distributed with Octave. In most cases, code that |
|
158 simply accesses internal variables does not need to change. Code |
|
159 that sets internal variables will change. For example, instead of |
|
160 writing |
|
161 <pre> |
|
162 PS1 = ">> "; |
|
163 </pre> |
|
164 you will need to write |
|
165 <pre> |
|
166 PS1 (">> "); |
|
167 </pre> |
|
168 If you need write code that will run in both old and new versions |
|
169 of Octave, you can use something like |
|
170 <pre> |
|
171 if (exist ("OCTAVE_VERSION") == 5) |
|
172 ## New: |
|
173 PS1 (">> "); |
|
174 else |
|
175 ## Old: |
|
176 PS1 = ">> "; |
|
177 endif |
|
178 </pre></li> |
|
179 |
|
180 |
|
181 <li>For compatibility with Matlab, the output order of Octave's |
|
182 <tt>"system"</tt> function has changed from |
|
183 <pre> |
|
184 [output, status] = system (cmd); |
|
185 </pre> |
|
186 to |
|
187 <pre> |
|
188 [status, output] = system (cmd); |
|
189 </pre></li> |
|
190 |
|
191 |
|
192 <li>For compatibility with Matlab, <tt>normcdf</tt>, <tt>norminv</tt>, |
|
193 <tt>normpdf</tt>, and <tt>normrnd</tt> have been modified to |
|
194 compute distributions using the standard deviation instead of the |
|
195 variance.</li> |
|
196 |
|
197 |
|
198 <li>For compatibility with Matlab, the output of Octave's fsolve |
|
199 function has been changed from |
|
200 <pre> |
|
201 [x, info, msg] = fsolve (...); |
|
202 </pre> |
|
203 to |
|
204 <pre> |
|
205 [x, fval, info] = fsolve (...); |
|
206 </pre></li> |
|
207 |
|
208 |
|
209 <li>For compatibility with Matlab, <tt>normcdf</tt>, <tt>norminv</tt>, |
|
210 <tt>normpdf</tt>, and <tt>normrnd</tt> have been modified to |
|
211 compute distributions using the standard deviation instead of the |
|
212 variance.</li> |
|
213 |
|
214 |
|
215 <li>For compatibility with |
|
216 Matlab, <tt>gamcdf</tt>, <tt>gaminv</tt>, <tt>gampdf</tt>, |
|
217 <tt>gamrnd</tt>, <tt>expcdf</tt>, <tt>expinv</tt>, <tt>exppdf</tt> |
|
218 and <tt>exprnd</tt> have been modified to compute the |
|
219 distributions using the standard scale factor rather than one over |
|
220 the scale factor. |
|
221 </ul> |