Posted By

Scooter on 11/08/08


Tagged

math


Versions (?)

Sinc function


 / Published in: PHP
 

URL: http://reusablecode.blogspot.com/2008/11/sinc-function.html

Both normalized and unnormalized sinc functions. Apparently useful for digital signal processing.

  1. <?php
  2. /*
  3.   Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved.
  4.  
  5.   This work is licensed under the Creative Commons Attribution License. To view
  6.   a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or
  7.   send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
  8.   94305, USA.
  9.   */
  10.  
  11. // Unnormalized sinc function.
  12. function sinc($x)
  13. {
  14. return sin($x) / $x;
  15. }
  16.  
  17. // Normalized sinc function.
  18. function nsinc($x)
  19. {
  20. return sin(M_PI * $x) / (M_PI * $x);
  21. }
  22. ?>

Report this snippet  

You need to login to post a comment.