Home | Develop | Download | Contact
testprog2.c
1 /*
2  * testprog2.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 
41 #include <config.h>
42 #include <stdlib.h>
43 #include <pds/pdsds.h>
44 #include <pds/pdsvector.h>
45 #include "extras.h"
46 #include <math.h>
47 
48 int main(int argc, char** argv)
49 {
51  PdsIQWave *WAVE=NULL;
52  PdsVector *Yc=NULL;
53  PdsVector *Ys=NULL;
54  PdsDsReal A,Teta;
55  PdsDsNatural N,n;
56 
57  FILE *fd=NULL;
58  char DATAFILE[]="datos.txt";
59  char OCTAVEFILE[]="plotinoctave.m";
60 
61 
62  A=1.0;
63  Teta=M_PI/32.0;
64  N=256;
65  Yc=pds_vector_new(N);
66  if(Yc==NULL) return EXIT_FAILURE;
67  Ys=pds_vector_new(N);
68  if(Ys==NULL) return EXIT_FAILURE;
69 
70  WAVE=pds_iqwave_new(A,Teta);
71  if(WAVE==NULL) return EXIT_FAILURE;
72 
73  n=pds_iqwave_get_vector(WAVE,Yc,Ys);
74 
75  fd=fopen(DATAFILE,"w");
76  if(fd==NULL) return EXIT_FAILURE;
77  pds_vector_fprintf(Yc,fd);
78  pds_vector_fprintf(Ys,fd);
79  fclose(fd);
80 
81  pds_octave_plot_2lin(OCTAVEFILE,DATAFILE);
82 
83  pds_iqwave_free(WAVE);
84  pds_vector_free(Yc);
85  pds_vector_free(Ys);
86 
87 
88  return EXIT_SUCCESS;
89 }
La estructura tipo PdsIQWave .
Definition: pdsiqwave.h:104
PdsIQWave * pds_iqwave_new(PdsDsReal A, PdsDsReal Teta)
Crea una estructura de tipo PdsIQWave.
unsigned int PdsDsNatural
Definition: pdsdsglobal.h:47
int pds_iqwave_get_vector(PdsIQWave *WAVE, PdsVector *VectorC, PdsVector *VectorS)
Carga un par de vectores con valores obtenidos en la salida del generador IQ. Realiza una iteración p...
void pds_iqwave_free(PdsIQWave *WAVE)
Libera una estructura de tipo puntero PdsIQWave.
float PdsDsReal
Definition: pdsdsglobal.h:42

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed