{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

a4p4(introprog1620 perry)

a4p4(introprog1620 perry) - T =(randy 1*20 p =(randy*pi w =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <time.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #define pi 4*atan(1) double randy(void) { return rand()/(RAND_MAX + 1.0); /* 0 <= ret value <1.0*/ } int main(void) /* initialize variables */ {double y, A, w, T, n, p; int t; y = A*sin( w*t + p) + n; A = randy()+1; /* could this work? T= randy()+20 */
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: T = (randy()+1)*20; p = (randy())*pi; w = 2*pi/T; srand(time(0)); n = (randy()*.6*A)-.3*A; /* print columns of t and y */ printf(" t y\n"); /* for loop that goes from 0 to 100 with intervals of 1 */ for( t=0; t<101; ++t) { /* prints t and y values in table */ printf("%4i %g\n", t, y); } return 0; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online