Hi,
I have to write a program in C programming to plot a sin curve using array.
i would appreciate if someone could give me and give me some hints on how about to do that.
thanks. :D
Hi,
I have to write a program in C programming to plot a sin curve using array.
i would appreciate if someone could give me and give me some hints on how about to do that.
thanks. :D
Do you need to actually draw it, or just plot the coordinates so that they can be imported into something like Excel?
if possible i could actually like to know ways of doing it ?
i've heard of plotting the cordinates using excel, perhaps u could guide me further in how about to do that if possible..
thanks.
Well, the code is easy if you know the formulas:
#include <math.h>
#include <stdio.h>
int main ( void )
{
double pi = 3.14159;
int i;
for ( i = 0; i <= 360 / 20; ++i ) {
double degrees = 20 * i;
double radians = 2 * pi * ( degrees / 360.0 );
printf ( "%f,%f\n", degrees, sin ( radians ) );
}
return 0;
}
Just take the output of that program, then import it into Excel and make a chart out of it.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.