Home | Develop | Download | Contact
testprog1.c
1 /*
2  * testprog1.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 
39 #include <config.h>
40 #include <stdlib.h>
41 #include <pds/pdsds.h>
42 #include <pds/pdsvector.h>
43 #include "extras.h"
44 #include <math.h>
45 
46 int main(int argc, char** argv)
47 {
49  PdsSWave *WAVE=NULL;
50  PdsVector *Y=NULL;
51  PdsDsReal A,Teta;
52  PdsDsNatural N;
53 
54  FILE *fd=NULL;
55  char DATAFILE[]="datos.txt";
56  char OCTAVEFILE[]="plotinoctave.m";
57 
58 
59  A=1.0;
60  Teta=M_PI/32.0;
61  N=256;
62  Y=pds_vector_new(N);
63  if(Y==NULL) return EXIT_FAILURE;
64 
65  WAVE=pds_swave_new(A,Teta);
66  if(WAVE==NULL) return EXIT_FAILURE;
67 
68  pds_swave_get_vector(WAVE,Y);
69 
70  fd=fopen(DATAFILE,"w");
71  if(fd==NULL) return EXIT_FAILURE;
72  pds_vector_fprintf(Y,fd);
73  fclose(fd);
74 
75  pds_octave_plot_lin(OCTAVEFILE,DATAFILE);
76 
77  pds_swave_free(WAVE);
78  pds_vector_free(Y);
79 
80 
81  return EXIT_SUCCESS;
82 }
PdsSWave * pds_swave_new(PdsDsReal A, PdsDsReal Teta)
Crea una estructura de tipo PdsSWave.
int pds_swave_get_vector(PdsSWave *WAVE, PdsVector *Vector)
Carga un vector con valores obtenidos en la salida del generador sinusoidal. Realiza una iteración pa...
unsigned int PdsDsNatural
Definition: pdsdsglobal.h:47
La estructura tipo PdsSWave .
Definition: pdsswave.h:104
void pds_swave_free(PdsSWave *WAVE)
Libera una estructura de tipo puntero PdsSWave.
float PdsDsReal
Definition: pdsdsglobal.h:42

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed