home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / ELMAT.DI$ / MESHDOM.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  1.2 KB  |  32 lines

  1. function [X,Y] = meshdom(x,y)
  2. %MESHDOM  Generate X and Y arrays for 3-d plots.
  3. %    This is an obsolete routine.  Use the new MESHGRID instead.
  4. %    Note: The MESHGRID with MATLAB Version 4.0 produces a Y which is
  5. %    flipud(Y) of the Y from MESHDOM.
  6. %    The usage remains the same and the mesh plots are the same if
  7. %    Version 4.0 has been set to axis('ij').
  8. %
  9. %    [X,Y] = MESHDOM(x,y)  transforms the domain specified by vectors
  10. %    x and y into arrays X and Y that can be used for the evaluation
  11. %    of functions of two variables and 3-d mesh and surface plots.
  12. %    The rows of the output array X are copies of the vector x and
  13. %    the columns of the output array Y are copies of the vector y.
  14. %
  15. %    For example, to evaluate and plot the function  x*exp(-x^2-y^2)
  16. %    over the range  -2 < x < 2, -2 < y < 2,
  17. %
  18. %        [X,Y] = meshdom(-2:.2:2, -2:.2:2);
  19. %        Z = X .* exp(-X.^2 - Y.^2);
  20. %        mesh(Z)
  21.  
  22. %
  23. %     J. N. Little, 12-2-85; C. B. Moler, 8-20-91.
  24. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  25.  
  26. % Make sure x is a full row vector and y is a full column vector.
  27. x = full(x(:)).';
  28. y = full(y(:));
  29. X = x(ones(size(y)),:);
  30. y = y(length(y):-1:1);
  31. Y = y(:,ones(size(x)));
  32.