libdspl-2.0/examples/src/cheby_poly2_test.c

42 wiersze
1.2 KiB
C
Czysty Zwykły widok Historia

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dspl.h"
#define N 250
2019-11-04 14:05:33 +00:00
int main(int argc, char* argv[])
{
Added gnuplot interface commande line functions. No need to use plt filees anymore Changes to be committed: deleted: bin/gnuplot/bessel_i0.plt deleted: bin/gnuplot/bilinear_test.plt deleted: bin/gnuplot/butter_ap_test.plt deleted: bin/gnuplot/cheby1_ap_test.plt deleted: bin/gnuplot/cheby_poly1.plt deleted: bin/gnuplot/cheby_poly2.plt deleted: bin/gnuplot/filter_iir.plt deleted: bin/gnuplot/gnuplot_script.plt deleted: bin/gnuplot/iir_bstop.plt deleted: bin/gnuplot/iir_lpf.plt deleted: bin/gnuplot/iir_test.plt deleted: bin/gnuplot/sinc_test.plt deleted: bin/gnuplot/sine_int.plt modified: bin/img/bessel_i0.png modified: bin/img/bilinear.png modified: bin/img/cheby_poly1.png modified: bin/img/cheby_poly2.png modified: bin/img/filter_iir_test.png deleted: bin/img/gnuplot_script.png modified: bin/img/iir_bstop.png modified: bin/img/iir_lpf.png modified: bin/img/iir_test.png modified: bin/img/sinc_test.png new file: dspl/doc/html/_form0_tmp.ps new file: dspl/doc/html/_formulas.aux new file: dspl/doc/html/_formulas.dvi new file: dspl/doc/html/_formulas.log new file: dspl/doc/html/_formulas.tex deleted: dspl/doc/html/formula.repository modified: dspl/dox/doxyfile_ru modified: dspl/dox/ru/error_list.dox new file: dspl/dox/ru/gnuplot.dox modified: dspl/dox/ru/groups_define.dox modified: dspl/dox/ru/mainpage.dox new file: dspl/src/gnuplot.c modified: dspl/src/inout.c modified: examples/src/bessel_i0.c modified: examples/src/bilinear_test.c modified: examples/src/butter_ap_test.c modified: examples/src/cheby1_ap_test.c modified: examples/src/cheby2_ap_zp_test.c modified: examples/src/cheby_poly1_test.c modified: examples/src/cheby_poly2_test.c modified: examples/src/filter_iir_test.c modified: examples/src/gnuplot_script_test.c modified: examples/src/iir_bstop.c modified: examples/src/iir_lpf.c modified: examples/src/iir_test.c modified: examples/src/sinc_test.c modified: examples/src/sine_int_test.c deleted: examples/src/test.c modified: ide/codeblocks/examples.depend modified: include/dspl.c modified: include/dspl.h
2020-01-09 19:31:03 +00:00
void* hdspl; /* DSPL handle */
void* hplot; /* GNUPLOT handle */
2020-07-17 18:09:28 +00:00
double x[N], y[N];
int ord;
char fn[64];
2020-07-17 18:09:28 +00:00
hdspl = dspl_load(); /* Load DSPL function */
linspace(-1.0, 1.0, N, DSPL_SYMMETRIC, x);
for(ord = 1; ord < 5; ord++)
{
cheby_poly2(x, N, ord, y);
sprintf(fn, "dat/cheby_poly2_ord%d.txt", ord);
writetxt(x,y,N,fn);
}
Added gnuplot interface commande line functions. No need to use plt filees anymore Changes to be committed: deleted: bin/gnuplot/bessel_i0.plt deleted: bin/gnuplot/bilinear_test.plt deleted: bin/gnuplot/butter_ap_test.plt deleted: bin/gnuplot/cheby1_ap_test.plt deleted: bin/gnuplot/cheby_poly1.plt deleted: bin/gnuplot/cheby_poly2.plt deleted: bin/gnuplot/filter_iir.plt deleted: bin/gnuplot/gnuplot_script.plt deleted: bin/gnuplot/iir_bstop.plt deleted: bin/gnuplot/iir_lpf.plt deleted: bin/gnuplot/iir_test.plt deleted: bin/gnuplot/sinc_test.plt deleted: bin/gnuplot/sine_int.plt modified: bin/img/bessel_i0.png modified: bin/img/bilinear.png modified: bin/img/cheby_poly1.png modified: bin/img/cheby_poly2.png modified: bin/img/filter_iir_test.png deleted: bin/img/gnuplot_script.png modified: bin/img/iir_bstop.png modified: bin/img/iir_lpf.png modified: bin/img/iir_test.png modified: bin/img/sinc_test.png new file: dspl/doc/html/_form0_tmp.ps new file: dspl/doc/html/_formulas.aux new file: dspl/doc/html/_formulas.dvi new file: dspl/doc/html/_formulas.log new file: dspl/doc/html/_formulas.tex deleted: dspl/doc/html/formula.repository modified: dspl/dox/doxyfile_ru modified: dspl/dox/ru/error_list.dox new file: dspl/dox/ru/gnuplot.dox modified: dspl/dox/ru/groups_define.dox modified: dspl/dox/ru/mainpage.dox new file: dspl/src/gnuplot.c modified: dspl/src/inout.c modified: examples/src/bessel_i0.c modified: examples/src/bilinear_test.c modified: examples/src/butter_ap_test.c modified: examples/src/cheby1_ap_test.c modified: examples/src/cheby2_ap_zp_test.c modified: examples/src/cheby_poly1_test.c modified: examples/src/cheby_poly2_test.c modified: examples/src/filter_iir_test.c modified: examples/src/gnuplot_script_test.c modified: examples/src/iir_bstop.c modified: examples/src/iir_lpf.c modified: examples/src/iir_test.c modified: examples/src/sinc_test.c modified: examples/src/sine_int_test.c deleted: examples/src/test.c modified: ide/codeblocks/examples.depend modified: include/dspl.c modified: include/dspl.h
2020-01-09 19:31:03 +00:00
/* plotting by GNUPLOT */
gnuplot_create(argc, argv, 560, 380, "img/cheby_poly2.png", &hplot);
gnuplot_cmd(hplot, "set grid");
gnuplot_cmd(hplot, "set key left top");
gnuplot_cmd(hplot, "set xlabel 'x'");
gnuplot_cmd(hplot, "set ylabel 'U_N (x)'");
gnuplot_cmd(hplot, "set yrange [-3.5:3.5]");
gnuplot_cmd(hplot, "plot 'dat/cheby_poly2_ord1.txt' with lines, \\");
gnuplot_cmd(hplot, " 'dat/cheby_poly2_ord2.txt' with lines, \\");
gnuplot_cmd(hplot, " 'dat/cheby_poly2_ord3.txt' with lines, \\");
gnuplot_cmd(hplot, " 'dat/cheby_poly2_ord4.txt' with lines");
gnuplot_close(hplot);
2019-11-04 14:05:33 +00:00
2020-07-17 18:09:28 +00:00
dspl_free(hdspl); /* free dspl handle */
2019-11-04 14:05:33 +00:00
return 0;
}