Home | Develop | Download | Contact
testprog3.c
1 /*
2  * testprog3.c
3  *
4  * Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
23 
34 #include <config.h>
35 #include <stdlib.h>
36 #include <pds/pdsds.h>
37 #include <pds/pdsvector.h>
38 #include "extras.h"
39 #include <math.h>
40 
41 int main(int argc, char** argv)
42 {
44  PdsWave *WAVE=NULL;
45  PdsVector *X=NULL;
46  PdsVector *Y=NULL;
47  PdsDsNatural N,n,i;
48 
49  FILE *fd=NULL;
50  char DATAFILE[]="datos.txt";
51  char OCTAVEFILE[]="plotinoctave.m";
52 
53  N=64;
54  Y=pds_vector_new(8*N);
55  if(Y==NULL) return EXIT_FAILURE;
56 
58  X=pds_vector_new(N);
59  if(X==NULL) return EXIT_FAILURE;
60  for(i=0;i<N;i++) X->V[i]=i;
62 
63 
65  WAVE=pds_wave_new_vector(X);
66  if(WAVE==NULL) return EXIT_FAILURE;
67  n=pds_wave_get_vector(WAVE,Y);
68  pds_wave_free(WAVE);
70 
71  fd=fopen(DATAFILE,"w");
72  if(fd==NULL) return EXIT_FAILURE;
73  pds_vector_fprintf(Y,fd);
74  fclose(fd);
75 
76  pds_octave_plot_lin(OCTAVEFILE,DATAFILE);
77 
78 
79  pds_vector_free(X);
80  pds_vector_free(Y);
81 
82  return EXIT_SUCCESS;
83 }
int pds_wave_get_vector(PdsWave *WAVE, PdsVector *Vector)
Carga un vector con valores obtenidos en la salida del generador de onda. Realiza una iteración para ...
PdsWave * pds_wave_new_vector(const PdsVector *VecSrc)
Crea una estructura de tipo PdsWave usando como fuente el vector VecSrc.
unsigned int PdsDsNatural
Definition: pdsdsglobal.h:47
void pds_wave_free(PdsWave *WAVE)
Libera una estructura de tipo puntero PdsWave.
La estructura tipo PdsWave .
Definition: pdswave.h:77

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed