home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 5.ddi / SPLINES.DI$ / FNPLT.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  912 b   |  28 lines

  1. function points=fnplt(f,symbol,interv)
  2. % FNPLT    Evaluate and plot a spline or pp.
  3. %
  4. %     [points=] fnplt(f[,symbol[,interv]])
  5. %
  6. %  plots the given function  f  (between its extreme breaks by default,
  7. %  else on the optionally specified interval  interv ),
  8. %  using the  symbol  (optionally) specified . 
  9. %  Also returns the plotted points in  points=[x;v]  or  v([1:2],:) .
  10.  
  11. % C. de Boor / latest change: Feb.25, 1989
  12. % C. de Boor / latest change: December 1, 1990 (add interval specification)
  13. % Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.
  14.  
  15. if (f(1)==11), f=sp2pp(f);end
  16. if (nargin>=3), f = ppcut(f,interv); end
  17.  
  18. [breaks,coefs,l,k,d]=ppbrk(f);
  19. npoints=100;
  20. x=breaks(1)+[0:npoints]*((breaks(l+1)-breaks(1))/npoints);
  21. v=ppual(f,x);
  22.  
  23. if (nargin==1), symbol='-';end
  24. if (d==1), plot(x,v,symbol);points=[x;v];
  25. else,plot(v(1,:),v(2,:),symbol);points=v([1,2],:);
  26. end
  27. drawnow
  28.