Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- long double harmoniczna[20];
- long double czestotliwosc, amplituda,okres,w,a[20],b[20],x[20],p;
- long double pi=3.14159265359, a0=0.5, t=1;
- using namespace std;
- int main()
- {
- cout<<"Podaj czestotliwosc sygnalu(Hz): ";
- cin>>czestotliwosc;
- cout<<endl<<"Podaj amplitude sygnalu (V): ";
- cin>>amplituda;
- cout<<endl<<"Trwa rozwijanie w szereg Fouriera podanego sygnalu, prosze czekac"<<endl;
- w=2.0*pi*czestotliwosc;
- for (int i=0.0;i<20.0;i++){
- a[i]=((2.0*(sin(i*w*1.0)))/(i*w));
- b[i]=(-2.0*(cos(i*w*1.0))-2.0)/(i*w);
- x[i]=(a[i]*(cos(i*w*1.0))+b[i]*(sin(i*w*1.0)));
- cout<<i*w*1.0<<" "<<x[i]<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement