fork download
  1. #include <graph.h>
  2. #include <conio.h>
  3. #include <stdio.h>
  4. #include <math.h>
  5.  
  6. #define XDIM 320
  7. #define YDIM 320
  8.  
  9. float fX[XDIM + 1], fY[YDIM + 1];
  10.  
  11. void main (void)
  12. {
  13. /*
  14. ******** PROGRAM NO.1 DIGITAL BANDPASS FILTER ********
  15. */
  16.  
  17. int iCount;
  18. clearscreen (_GCLEARSCREEN);
  19. printf ("PROGRAM l: Digital bandpass fi1ter\n");
  20. printf ("Press any key to start...\n\n");
  21.  
  22. /*
  23. ***** GENERATE INPUT SIGNAL, AND LOAD INTO ARRAY X *****
  24. */
  25.  
  26. for (iCount = 1; iCount <= XDIM; iCount++)
  27. fX[iCount] = sin (3.141593 *
  28. (float)iCount *
  29. (0.05 + 0.0005 * (f1oat)iCount));
  30.  
  31. /*
  32. ****** ESTIMATE OUTPUT SIGNAL OF RECURSIVE FILTER *******
  33. */
  34.  
  35. fY[l] = 0.0;
  36. fY[2] = 0.0;
  37.  
  38. for (iCount = 3; iCount <= YDIM; iCount++)
  39. fY[iCount] = 1.5 *
  40. fY[iCount - 1] - 0.85 *
  41. fY[iCount — 2] + fX[iCount];
  42.  
  43.  
  44. /*
  45. ******* PLOT INPUT AND 0u·1·1>UT SIGNALS ON SCREEN *********
  46. */
  47.  
  48. _setvideomode( _MRES16COLOR );
  49.  
  50. for (iCount = 1; iCount <= XDIM; iCount++)
  51. {
  52. _moveto (iCount, 50);
  53. _lineto (iCount, (int)(50.0 - fX[iCount] * 25.0 + O.5));
  54.  
  55. _moveto (iCount, 150);
  56. _lineto (iCount, (1nt)(150.0 - fY[iCount] * 4.0 + O.5));
  57. }
  58.  
  59.  
  60. _setvideomode( _DEFAULTMODE );
  61. /*
  62. ·k·k**********·k*·k·k1:**~k·k·k·k1:*1:***·k*~A··k**·k**************%*11******
  63. */
  64. }
  65.  
  66.  
Success #stdin #stdout 0.02s 2280KB
stdin
Standard input is empty
stdout
Standard output is empty