/* this file is scan.c */ /* anything between slash-star and star-slash is a comment */ /* even if it's not on the same line */ // anything to right of double-slash is also a comment // even if there's real code on the left #include // needed for math functions to work main () // this is the start of the actual program { /* declare names and types of variables */ float freq, ampl, range; float fmin1, fmin2, fmin3; float fmax1, fmax2, fmax3; int nstep1, nstep2, nstep3; int i, j; float fact1, fact2, fact3; float a, b, c; float twopi, w; float t1, t2; /* set constants */ twopi=8.0*atan(1.0); a=1.0; b=0.01; c=1.0; /* set scan ranges */ fmin1=0.01; fmin2=0.1; fmin3=0.2; fmax3=5.0; /* set scan steps */ nstep1=5; nstep2=5; nstep3=5; /* calculate other limits */ fmax1=fmin2; fmax2=fmin3; /* find frequency step factors */ fact1=pow(fmax1/fmin1,1.0/(nstep1-1)); fact2=pow(fmax2/fmin2,1.0/(nstep2-1)); fact3=pow(fmax3/fmin3,1.0/(nstep3-1)); /* initialize counter */ j=0; /* first frequency range */ freq=fmin1; range=1.0; /* loop over frequency steps */ for (i=0; i 2.0) { printf("#Whoopee!\n"); } /* wait for one second */ //sleep(1); /* find next frequency */ freq = freq * fact1; /* increment counter */ j=j+1; } /* second frequency range */ freq=fmin2; range=1.0; /* loop over frequency steps */ for (i=0; i 2.0) { printf("#Whoopee!\n"); } /* wait for one second */ // sleep(1); /* find next frequency */ freq = freq * fact2; /* increment counter */ j=j+1; } /* third frequency range */ freq=fmin3; range=1.0; /* loop over frequency steps */ /* this time, don't leave out the last step */ for (i=0; i 2.0) { printf("#Whoopee!\n"); } /* wait for one second */ sleep(1); /* find next frequency */ freq = freq * fact3; /* increment counter */ j=j+1; } }