spence21.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/REC-html40/loose.dtd">
  3. <html>
  4. <head>
  5. <title>Description of spence21</title>
  6. <meta name="keywords" content="spence21">
  7. <meta name="description" content="function for Spencer's 21-point graduation rule.">
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  9. <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  10. <meta name="robots" content="index, follow">
  11. <link type="text/css" rel="stylesheet" href="../../../m2html.css">
  12. <script type="text/javascript">
  13. if (top.frames.length == 0) { top.location = "../../../index.html"; };
  14. </script>
  15. </head>
  16. <body>
  17. <a name="_top"></a>
  18. <!-- ../../menu.html chronux_2_10 --><!-- # locfit --><!-- menu.html m -->
  19. <h1>spence21
  20. </h1>
  21. <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  22. <div class="box"><strong>function for Spencer's 21-point graduation rule.</strong></div>
  23. <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  24. <div class="box"><strong>function yhat=spence21(y) </strong></div>
  25. <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  26. <div class="fragment"><pre class="comment"> function for Spencer's 21-point graduation rule.
  27. set out following Spencer's hand-calculation method,
  28. which isn't the shortest computer program!</pre></div>
  29. <!-- crossreference -->
  30. <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  31. This function calls:
  32. <ul style="list-style-image:url(../../../matlabicon.gif)">
  33. </ul>
  34. This function is called by:
  35. <ul style="list-style-image:url(../../../matlabicon.gif)">
  36. <li><a href="../../../chronux_2_10/locfit/Book/fig1_2.html" class="code" title="">fig1_2</a> Local Regression and Likelihood, Figure 1.2.</li></ul>
  37. <!-- crossreference -->
  38. <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  39. <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function yhat=spence21(y)</a>
  40. 0002 <span class="comment">% function for Spencer's 21-point graduation rule.</span>
  41. 0003 <span class="comment">% set out following Spencer's hand-calculation method,</span>
  42. 0004 <span class="comment">% which isn't the shortest computer program!</span>
  43. 0005
  44. 0006 oten = ones(10,1);
  45. 0007 n = length(y);
  46. 0008 y = [ oten*y(1); y; oten*y(n) ];
  47. 0009
  48. 0010 n = length(y);
  49. 0011 k = 4:(n-3);
  50. 0012 y1 = -y(k-3) + y(k-1) + 2*y(k) + y(k+1) -y(k+3);
  51. 0013
  52. 0014 n = length(y1);
  53. 0015 k = 4:(n-3);
  54. 0016 y2 = y1(k-3)+y1(k-2)+y1(k-1)+y1(k)+y1(k+1)+y1(k+2)+y1(k+3);
  55. 0017
  56. 0018 n = length(y2);
  57. 0019 k = 3:(n-2);
  58. 0020 y3 = y2(k-2)+y2(k-1)+y2(k)+y2(k+1)+y2(k+2);
  59. 0021
  60. 0022 n = length(y3);
  61. 0023 k = 3:(n-2);
  62. 0024 y4 = y3(k-2)+y3(k-1)+y3(k)+y3(k+1)+y3(k+2);
  63. 0025
  64. 0026 yhat = y4/350;
  65. 0027 <span class="keyword">return</span>;</pre></div>
  66. <hr><address>Generated on Fri 12-Aug-2011 11:36:15 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
  67. </body>
  68. </html>