#include #include #include #include int main(int c,char *p[]) { float a, b, u, t, x, y, yz=0, y2z=0, s, f, d, deltaT=0.000125, theta; u=atoi(p[1]); // prevadime amplitudu if(u==0) { printf("takhle to nepujde\n"); return 1; } f=atof(p[2]); // prevadime kmitocet if(f<=0) { printf("takhle to taky nepujde\n"); return 1; } d=atoi(p[3]); // prevadime cas if(d<=0) { printf("tak to taky ne hele\n"); return 1; } d=(d/1000); // prevadime delku signalu z ms na s theta=2*M_PI*(f/8000); a=sin(theta); b=2*cos(theta); for(t=0;t<=d;t=t+deltaT) { s=u*sin(2*M_PI*f*t); // zakladni sinusovka if(t!=0.000125) x=0; else x=u; y=x*b+yz+a-y2z; // DSP y2z=yz; yz=y; printf("%9.6f %9.6f %9.6f\n",t,s,y); } return 1; }