Advertisement
Guest User

Untitled

a guest
Nov 26th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. long double harmoniczna[20];
  5. long double czestotliwosc, amplituda,okres,w,a[20],b[20],x[20],p;
  6. long double pi=3.14159265359, a0=0.5, t=1;
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.  
  12. cout<<"Podaj czestotliwosc sygnalu(Hz): ";
  13. cin>>czestotliwosc;
  14. cout<<endl<<"Podaj amplitude sygnalu (V): ";
  15. cin>>amplituda;
  16. cout<<endl<<"Trwa rozwijanie w szereg Fouriera podanego sygnalu, prosze czekac"<<endl;
  17.  
  18.  
  19. w=2.0*pi*czestotliwosc;
  20.  
  21. for (int i=0.0;i<20.0;i++){
  22. a[i]=((2.0*(sin(i*w*1.0)))/(i*w));
  23. b[i]=(-2.0*(cos(i*w*1.0))-2.0)/(i*w);
  24. x[i]=(a[i]*(cos(i*w*1.0))+b[i]*(sin(i*w*1.0)));
  25.  
  26. cout<<i*w*1.0<<" "<<x[i]<<endl;
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement