The sine wave can be simulated using Taylor series method. The sine wave values generated as a result of this simulation has been stored in a separate file. The following lines of code are used to simulate a sinusoidal signal using taylor series.
Step_size=0.5233 /*615 Hz*/
For (i=0;i<8000;i++)
{
sine1[i]=x-((powf(x,3)/6))+((powf(x,5)/120))-((powf(x,7)/5040))+((powf(x,9)/362880));
/* Taylors series expansion */
x=x+ Step_size;
If (x>3.14)
{
x=-3.14;
}
}
No comments:
Post a Comment