Mercurial > hg > octave-terminal
changeset 7165:5cae591f81a8
[project @ 2007-11-12 22:11:46 by jwe]
author | jwe |
---|---|
date | Mon, 12 Nov 2007 22:11:46 +0000 |
parents | 2b5e6c0a9df9 |
children | 4e7e5d51db86 |
files | scripts/plot/ribbon.m |
diffstat | 1 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/ribbon.m +++ b/scripts/plot/ribbon.m @@ -30,46 +30,46 @@ ## Author: Kai Habel <kai.habel at gmx.de> -function h = ribbon (x, y, width) +function h = ribbon (X, Y, W) newplot (); if (nargin == 1) - y = x; + Y = X; if (isvector (Y)) - y = y(:); + Y = Y(:); endif - [nr, nc] = size (y); + [nr, nc] = size (Y); X = repmat ((1:nr)', 1, nc); - width = 0.75; + W = 0.75; elseif (nargin == 2) - width = 0.75; + W = 0.75; elseif (nargin != 3) print_usage (); - endif + end - if (isvector (x) && isvector (y)) - if (length (x) != length (y)) - error ("ribbon: in case of vectors, x and y must have same length") + if (isvector (X) && isvector (Y)) + if (length (X) != length (Y)) + error ("ribbon: in case of vectors, X and Y must have same length") else - [x, y] = meshgrid (x, y); + [X, Y] = meshgrid (X, Y); endif else - if (! all (size (x) == size (y))) - error("In case of matrices, X and Y must have same size") + if (! all (size (X) == size (Y))) + error ("ribbon: in case of matrices, X and Y must have same size") endif endif - [nr, nc] = size (y); + [nr, nc] = size (Y); tmp = zeros (1, nc); for c = nc:-1:1 - zz = [y(:,c), y(:,c)]; - y = x(:,c); - x = [c - width / 2, c + width / 2]; - [xx, yy] = meshgrid (x, y); - cc = ones (size (zz)) * c; - tmp(c) = surface (xx, yy, zz, cc); + ZZ = [Y(:,c), Y(:,c)]; + y = X(:,c); + x = [c - W / 2, c + W / 2]; + [XX, YY] = meshgrid (x, y); + CC = ones (size (ZZ)) * c; + tmp(c) = surface (XX, YY, ZZ, CC); endfor ax = get (tmp(c), "parent");