I have to complete a task related to calculation of Sine values.
I made whole of the program but the first value Im getting, i.e. a * Sin(0), is always displayed as 10 rather than 0.
This is the loop code I tried :
Anyone can help...!
Thanks :):):)
I made whole of the program but the first value Im getting, i.e. a * Sin(0), is always displayed as 10 rather than 0.
This is the loop code I tried :
Code:
//All the values a,f,fs.... are of float type.
for(n = 0;n <= N-1; n++)
{
double *s = malloc(sizeof(double));
double *x = malloc(sizeof(double));
*x = (2 * PI * (f / fs)* n);
*s = a * sin(*x);
printf("%f\n",*s);
}
Thanks :):):)
Comment