#include <config.h>
#include <stdlib.h>
#include <pds/pdsdf.h>
#include <pds/pdsvector.h>
#include "extras.h"
#include <math.h>
int main(int argc, char** argv)
{
PdsVector *hden=NULL;
PdsVector *hnum=NULL;
FILE *fd=NULL;
char DATAFILE[]="datos.txt";
char OCTAVEFILE[]="plotinoctave.m";
PdsVector *X=NULL;
PdsVector *Y1=NULL;
PdsVector *Y2=NULL;
PdsRaReal num[]={1/20.0,1/20.0};
hnum=pds_vector_new_array1d(num,2);
PdsRaReal den[]={1.0 ,-0.9 };
hden=pds_vector_new_array1d(den,2);
N=128;
X=pds_vector_new(N);
Y1=pds_vector_new(N);
for(n=0;n<N;n++)
{
x=1.0+sin(M_PI*n/32.0)+sin(3.0*M_PI*n/4.0+M_PI/16.0);
X->V[n]=x;
Y1->V[n]=y;
}
Y2=pds_vector_new(N);
fd=fopen(DATAFILE,"w");
if(fd==NULL) return EXIT_FAILURE;
pds_vector_fprintf(X,fd);
pds_vector_fprintf(Y1,fd);
pds_vector_fprintf(Y2,fd);
fclose(fd);
pds_octave_plot_lin(OCTAVEFILE,DATAFILE);
pds_vector_free(hnum);
pds_vector_free(hden);
return EXIT_SUCCESS;
}