Commit eb30644f authored by Hans Buchmann's avatar Hans Buchmann

solution

parent f2a21194
......@@ -69,7 +69,34 @@ double cos_(double alfa)
//use sin_ resp. cos_ for sin resp cos
//use sin_ resp. cos_ only once
/*
2*pi
|--d---|--d---|--d---|--d---|--d---|--d---|--d---|--d---|
0 T=1/f
d=1/fs
co1 = co0*cos(alfa)-si0*sin(alfa)
so1 = so0*sin(alfa)+si0*cos(alfa)
*/
//sine{
void sine(unsigned fs,double f,double s[],unsigned len)
{
double co=1; //cos
double si=0; //sin
double alfa=2*PI*f/fs;
double co_alfa=cos_(alfa);
double si_alfa=sin_(alfa);
for(unsigned i=0;i<len;++i)
{
s[i]=si;
double co1=co*co_alfa - si*si_alfa;
double si1=co*si_alfa + si*co_alfa;
co=co1;
si=si1;
}
}
//sine}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment