include

Anuncio
J:\TESIS\ASIGNATURAS\Instrumentación\Ejercicio1\Ejercicio1.c
#include
#include
#include
#include
1
<analysis.h>
<cvirte.h>
/* Needed if linking in external compiler; harmless otherwise */
<userint.h>
"Ejercicio1.h"
static int panelHandle;
int ciclos;
double seno[1000];
int plot_sen;
double amplitud;
double fase;
double ruido[1000];
double amp_ruido;
double suma[1000];
unsigned 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, "Ejercicio1.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
return 0;
}
int CVICALLBACK Pintar (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event) {
case EVENT_COMMIT:
GetCtrlVal (panelHandle, PANEL_NUMERIC, &ciclos);
GetCtrlVal (panelHandle, PANEL_NUMERIC_3, &amplitud);
GetCtrlVal (panelHandle, PANEL_NUMERIC_2, &fase);
GetCtrlVal (panelHandle, PANEL_NUMERIC_4, &amp_ruido);
GetCtrlVal (panelHandle, PANEL_COLORNUM, &color);
WhiteNoise (1000, amp_ruido, -1, ruido);
SinePattern (1000, amplitud, fase, ciclos, seno);
for (i=0;i<1000;i++){
suma[i]=ruido[i]+seno[i];
}
//Add1D (seno, ruido, 1000, suma);
PlotY (panelHandle, PANEL_GRAPH, suma, 1000, VAL_DOUBLE,
VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, color);
break;
}
return 0;
}
int CVICALLBACK Salir (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event) {
case EVENT_COMMIT:
QuitUserInterface (0);
break;
case EVENT_RIGHT_CLICK:
MessagePopup ("Ayuda", "Este botón es para salir del programa");
break;
}
return 0;
}
int CVICALLBACK Limpiar (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;
J:\TESIS\ASIGNATURAS\Instrumentación\Ejercicio1\Ejercicio1.c
}
return 0;
}
2
Descargar