seno #include #include harmless #include #include <analysis.h> <cvirte.h> otherwise */ <userint.h> "seno.h" /* Needed if linking in external compiler; static int panelHandle; static double sin[1000]; static double noise[1000]; static double sum[1000]; int cycle; double noiseamplitude; int color; int i; int main (int argc, char *argv[]) { if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */ return -1; /* out of memory */ if ((panelHandle = LoadPanel (0, "seno.uir", PANEL)) < 0) return -1; DisplayPanel (panelHandle); RunUserInterface (); return 0; } int CVICALLBACK Quit (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: QuitUserInterface (0); break; } return 0; } int CVICALLBACK Clear (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: DeleteGraphPlot (panelHandle, PANEL_GRAPH, -1, VAL_IMMEDIATE_DRAW); break; } return 0; } int CVICALLBACK AddWaves (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: GetCtrlVal (panelHandle, PANEL_NUMERIC, &cycle); GetCtrlVal (panelHandle, PANEL_NUMERIC_2, &noiseamplitude); GetCtrlVal (panelHandle, PANEL_COLORNUM, &color); SinePattern (1000, 1.0, 0.0, cycle, sin); WhiteNoise (1000, noiseamplitude, 1, noise); for (i=0; i<999; i++) Página 1 seno sum[i]=sin[i]+noise[i]; PlotY (panelHandle, PANEL_GRAPH, sum, 1000, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, color); break; } return 0; } Página 2