Guest User

Untitled

a guest
Jul 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. //============================================================================
  2. // Name : sinussignal.cpp
  3. // Author : pnguyen_
  4. // Version :
  5. // Copyright : Your copyright notice
  6. // Description : Hello World in C++, Ansi-style
  7. //============================================================================
  8.  
  9. #include <iostream>
  10. #include <math.h>
  11. using namespace std;
  12. const double PI = 3.141592;
  13.  
  14. void tues (double *&array, double T, double f, double fs)
  15. {
  16. double x;
  17.  
  18.  
  19. //Abtastpunkte = Arraygröße
  20. int n=T*fs;
  21. array= new double [n];
  22.  
  23.  
  24. //Bogenmaß; w=2*pi*f
  25. for(int i=0;i<n;i++)
  26. {
  27. array [i] = sin (i*(2*PI*(f/fs)));
  28.  
  29. cout << i << ' ' << array[i]<< endl;
  30.  
  31. }
  32. }
  33.  
  34.  
  35.  
  36. int main()
  37. {
  38.  
  39. double *a = NULL;
  40. tues(a,0.001,1000,50000);
  41. delete[] a;
  42. a=NULL;
  43.  
  44.  
  45.  
  46. return 0;
  47. }
Add Comment
Please, Sign In to add comment