octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch to sombrero.m


From: Quentin Spencer
Subject: Patch to sombrero.m
Date: Thu, 12 Oct 2006 16:30:51 -0500
User-agent: Thunderbird 1.5.0.7 (X11/20060913)

I've been experimenting with modifications to imagesc and surf to use the new gnuplot 4.2 features, and I like using the sombrero function to test them. The attached patch allows the sombrero function to return the function values without calling mesh if output arguments are supplied. This allows something like [x,y,z]=sombrero; surf(x,y,z);.

I also have a slightly related question--is there any way to get version information from gnuplot from within octave?

Quentin

--- cvs/scripts/plot/sombrero.m 2006-10-11 11:49:16.000000000 -0500
+++ sombrero.m  2006-10-12 16:05:07.000000000 -0500
@@ -30,7 +30,7 @@
 
 ## Author: jwe
 
-function sombrero (n)
+function [x, y, z] = sombrero (n)
 
   if (nargin == 0)
     n = 41;
@@ -42,7 +42,9 @@
       [xx, yy] = meshgrid (x, y);
       r = sqrt (xx .^ 2 + yy .^ 2) + eps;
       z = sin (r) ./ r;
-      mesh (x, y, z);
+      if (nargout == 0)
+        mesh (x, y, z);
+      end
     else
       error ("sombrero: number of grid lines must be greater than 1");
     endif

reply via email to

[Prev in Thread] Current Thread [Next in Thread]