From c1e475064c14d9dae8390667abf32b79d8a4b33f Mon Sep 17 00:00:00 2001 From: Dsplib Date: Wed, 27 Jun 2018 23:55:47 +0300 Subject: [PATCH] added function for 3d plot data saving --- dspl/src/filter_an.c | 625 +++++++++++++++++++++++------------------ dspl/src/inout.c | 165 +++++++---- include/dspl.c | 6 + include/dspl.h | 21 +- release/include/dspl.c | 6 + release/include/dspl.h | 21 +- 6 files changed, 516 insertions(+), 328 deletions(-) diff --git a/dspl/src/filter_an.c b/dspl/src/filter_an.c index 43c5d46..af47c4a 100644 --- a/dspl/src/filter_an.c +++ b/dspl/src/filter_an.c @@ -26,233 +26,302 @@ -/************************************************************************************************** + +/****************************************************************************** Complex frequency response of an analog filter H(s) -***************************************************************************************************/ -int DSPL_API freqs(double* b, double* a, int ord, double* w, int n, complex_t *h) +*******************************************************************************/ +int DSPL_API freqs(double* b, double* a, int ord, + double* w, int n, complex_t *h) { - complex_t jw; - complex_t *bc = NULL; - complex_t *ac = NULL; - complex_t num, den; - double mag; - int k; - int res; - - if(!b || !a || !w || !h) - return ERROR_PTR; - if(ord<0) - return ERROR_FILTER_ORD; - if(n<1) - return ERROR_SIZE; - - RE(jw) = 0.0; - - bc = (complex_t*) malloc((ord+1) * sizeof(complex_t)); - res = re2cmplx(b, ord+1, bc); - - if( res!=RES_OK ) - goto exit_label; - - ac = (complex_t*) malloc((ord+1) * sizeof(complex_t)); - res = re2cmplx(a, ord+1, ac); - if( res!=RES_OK ) - goto exit_label; - - for(k = 0; k < n; k++) - { - IM(jw) = w[k]; - res = polyval_cmplx(bc, ord, &jw, 1, &num); - if(res != RES_OK) - goto exit_label; - res = polyval_cmplx(ac, ord, &jw, 1, &den); - if(res != RES_OK) - goto exit_label; - mag = ABSSQR(den); - if(mag == 0.0) - { - res = ERROR_DIV_ZERO; - goto exit_label; - } - mag = 1.0 / mag; - RE(h[k]) = CMCONJRE(num, den) * mag; - IM(h[k]) = CMCONJIM(num, den) * mag; - - } - res = RES_OK; + complex_t jw; + complex_t *bc = NULL; + complex_t *ac = NULL; + complex_t num, den; + double mag; + int k; + int res; + + if(!b || !a || !w || !h) + return ERROR_PTR; + if(ord<0) + return ERROR_FILTER_ORD; + if(n<1) + return ERROR_SIZE; + + RE(jw) = 0.0; + + bc = (complex_t*) malloc((ord+1) * sizeof(complex_t)); + res = re2cmplx(b, ord+1, bc); + + if( res!=RES_OK ) + goto exit_label; + + ac = (complex_t*) malloc((ord+1) * sizeof(complex_t)); + res = re2cmplx(a, ord+1, ac); + if( res!=RES_OK ) + goto exit_label; + + for(k = 0; k < n; k++) + { + IM(jw) = w[k]; + res = polyval_cmplx(bc, ord, &jw, 1, &num); + if(res != RES_OK) + goto exit_label; + res = polyval_cmplx(ac, ord, &jw, 1, &den); + if(res != RES_OK) + goto exit_label; + mag = ABSSQR(den); + if(mag == 0.0) + { + res = ERROR_DIV_ZERO; + goto exit_label; + } + mag = 1.0 / mag; + RE(h[k]) = CMCONJRE(num, den) * mag; + IM(h[k]) = CMCONJIM(num, den) * mag; + } + res = RES_OK; exit_label: - if(bc) - free(bc); - if(ac) - free(ac); - return res; + if(bc) + free(bc); + if(ac) + free(ac); + return res; } -/************************************************************************************************** -impulse response of an analog filter H(s) -***************************************************************************************************/ -int DSPL_API freqs2time(double* b, double* a, int ord, double fs, int n, fft_t* pfft, double *t, double *h) + +/****************************************************************************** + * Complex frequency response of an analog filter H(s), s is complex variable + ******************************************************************************/ +int DSPL_API freqs_cmplx(double* b, double* a, int ord, + complex_t* s, int n, complex_t *h) { - double *w = NULL; - complex_t *hs = NULL; - complex_t *ht = NULL; - int err, k; - - if(!b || !a || !t || !h) - return ERROR_PTR; - if(ord<1) - return ERROR_FILTER_ORD; - if(n<1) - return ERROR_SIZE; - - w = (double*)malloc(n*sizeof(double)); - hs = (complex_t*)malloc(n*sizeof(complex_t)); - - - err = linspace(-fs*0.5, fs*0.5, n, DSPL_PERIODIC, w); - if(err != RES_OK) - goto exit_label; - - err = freqs(b, a, ord, w, n, hs); - if(err != RES_OK) - goto exit_label; - - err = fft_shift_cmplx(hs, n, hs); - if(err != RES_OK) - goto exit_label; - - ht = (complex_t*)malloc(n*sizeof(complex_t)); - - err = ifft_cmplx(hs, n, pfft, ht); - if(err != RES_OK) - { - err = idft_cmplx(hs, n, ht); - if(err != RES_OK) - goto exit_label; - } - - for(k = 0; k < n; k++) - { - t[k] = (double)k/fs; - h[k] = RE(ht[k]) * fs; - } - + complex_t *bc = NULL; + complex_t *ac = NULL; + complex_t num, den; + double mag; + int k; + int res; + + if(!b || !a || !s || !h) + return ERROR_PTR; + if(ord<0) + return ERROR_FILTER_ORD; + if(n<1) + return ERROR_SIZE; + + + bc = (complex_t*) malloc((ord+1) * sizeof(complex_t)); + res = re2cmplx(b, ord+1, bc); + + if( res!=RES_OK ) + goto exit_label; + + ac = (complex_t*) malloc((ord+1) * sizeof(complex_t)); + res = re2cmplx(a, ord+1, ac); + if( res!=RES_OK ) + goto exit_label; + + for(k = 0; k < n; k++) + { + res = polyval_cmplx(bc, ord, s+k, 1, &num); + if(res != RES_OK) + goto exit_label; + res = polyval_cmplx(ac, ord, s+k, 1, &den); + if(res != RES_OK) + goto exit_label; + mag = ABSSQR(den); + if(mag == 0.0) + { + res = ERROR_DIV_ZERO; + goto exit_label; + } + mag = 1.0 / mag; + RE(h[k]) = CMCONJRE(num, den) * mag; + IM(h[k]) = CMCONJIM(num, den) * mag; + + } + res = RES_OK; + exit_label: + if(bc) + free(bc); + if(ac) + free(ac); + return res; +} + + + + + + + +/****************************************************************************** +impulse response of an analog filter H(s) +*******************************************************************************/ +int DSPL_API freqs2time(double* b, double* a, int ord, double fs, + int n, fft_t* pfft, double *t, double *h) +{ + double *w = NULL; + complex_t *hs = NULL; + complex_t *ht = NULL; + int err, k; + + if(!b || !a || !t || !h) + return ERROR_PTR; + if(ord<1) + return ERROR_FILTER_ORD; + if(n<1) + return ERROR_SIZE; + + w = (double*)malloc(n*sizeof(double)); + hs = (complex_t*)malloc(n*sizeof(complex_t)); + + + err = linspace(-fs*0.5, fs*0.5, n, DSPL_PERIODIC, w); + if(err != RES_OK) + goto exit_label; + + err = freqs(b, a, ord, w, n, hs); + if(err != RES_OK) + goto exit_label; + + err = fft_shift_cmplx(hs, n, hs); + if(err != RES_OK) + goto exit_label; + + ht = (complex_t*)malloc(n*sizeof(complex_t)); + + err = ifft_cmplx(hs, n, pfft, ht); + if(err != RES_OK) + { + err = idft_cmplx(hs, n, ht); + if(err != RES_OK) + goto exit_label; + } + + for(k = 0; k < n; k++) + { + t[k] = (double)k/fs; + h[k] = RE(ht[k]) * fs; + } + exit_label: - if(w) - free(w); - if(hs) - free(hs); - if(ht) - free(ht); - return err; - + if(w) + free(w); + if(hs) + free(hs); + if(ht) + free(ht); + return err; } -/************************************************************************************************** +/****************************************************************************** Magnitude, phase response and group delay of an analog filter H(s) -***************************************************************************************************/ -int DSPL_API freqs_resp(double* b, double* a, int ord, double* w, int n, int flag, +*******************************************************************************/ +int DSPL_API freqs_resp(double* b, double* a, int ord, + double* w, int n, int flag, double *h, double* phi, double* tau) { - int res, k; - - complex_t *hc = NULL; - double *phi0 = NULL; - double *phi1 = NULL; - double *w0 = NULL; - double *w1 = NULL; - - if(!b || !a || !w) - return ERROR_PTR; - if(ord < 1) - return ERROR_FILTER_ORD; - if(n < 1) - return ERROR_SIZE; - - - hc = (complex_t*) malloc (n*sizeof(complex_t)); - res = freqs(b, a, ord, w, n, hc); - if(res != RES_OK) - goto exit_label; - - - if(h) - { - if(flag & DSPL_FLAG_LOG) - { - for(k = 0; k < n; k++) - h[k] = 10.0 * log10(ABSSQR(hc[k])); - } - else - { - for(k = 0; k < n; k++) - h[k] = sqrt(ABSSQR(hc[k])); - } - } - - - if(phi) - { - for(k = 0; k < n; k++) - phi[k] = atan2(IM(hc[k]), RE(hc[k])); - - if(flag & DSPL_FLAG_UNWRAP) - { - res = unwrap(phi, n, M_2PI, 0.8); - if(res != RES_OK) - goto exit_label; - } - - } - - - if(tau) - { - phi0 = (double*) malloc(n*sizeof(double)); - phi1 = (double*) malloc(n*sizeof(double)); - w0 = (double*) malloc(n*sizeof(double)); - w1 = (double*) malloc(n*sizeof(double)); - - w0[0] = w[0] - (w[1] - w[0])*0.02; - w1[0] = w[0] + (w[1] - w[0])*0.02; - - for(k = 1; k < n; k++) - { - w0[k] = w[k] - (w[k] - w[k-1])*0.02; - w1[k] = w[k] + (w[k] - w[k-1])*0.02; - } - res = freqs_resp(b, a, ord, w0, n, DSPL_FLAG_UNWRAP, NULL, phi0, NULL); - if(res != RES_OK) - goto exit_label; - res = freqs_resp(b, a, ord, w1, n, DSPL_FLAG_UNWRAP, NULL, phi1, NULL); - if(res != RES_OK) - goto exit_label; - for(k = 0; k < n; k++) - tau[k] = (phi0[k] - phi1[k])/(w1[k] - w0[k]); - - } - + int res, k; + + complex_t *hc = NULL; + double *phi0 = NULL; + double *phi1 = NULL; + double *w0 = NULL; + double *w1 = NULL; + + if(!b || !a || !w) + return ERROR_PTR; + if(ord < 1) + return ERROR_FILTER_ORD; + if(n < 1) + return ERROR_SIZE; + + + hc = (complex_t*) malloc (n*sizeof(complex_t)); + res = freqs(b, a, ord, w, n, hc); + if(res != RES_OK) + goto exit_label; + + + if(h) + { + if(flag & DSPL_FLAG_LOG) + { + for(k = 0; k < n; k++) + h[k] = 10.0 * log10(ABSSQR(hc[k])); + } + else + { + for(k = 0; k < n; k++) + h[k] = sqrt(ABSSQR(hc[k])); + } + } + + + if(phi) + { + for(k = 0; k < n; k++) + phi[k] = atan2(IM(hc[k]), RE(hc[k])); + + if(flag & DSPL_FLAG_UNWRAP) + { + res = unwrap(phi, n, M_2PI, 0.8); + if(res != RES_OK) + goto exit_label; + } + } + + + if(tau) + { + phi0 = (double*) malloc(n*sizeof(double)); + phi1 = (double*) malloc(n*sizeof(double)); + w0 = (double*) malloc(n*sizeof(double)); + w1 = (double*) malloc(n*sizeof(double)); + + w0[0] = w[0] - (w[1] - w[0])*0.02; + w1[0] = w[0] + (w[1] - w[0])*0.02; + + for(k = 1; k < n; k++) + { + w0[k] = w[k] - (w[k] - w[k-1])*0.02; + w1[k] = w[k] + (w[k] - w[k-1])*0.02; + } + res = freqs_resp(b, a, ord, w0, n, DSPL_FLAG_UNWRAP, + NULL, phi0, NULL); + if(res != RES_OK) + goto exit_label; + res = freqs_resp(b, a, ord, w1, n, DSPL_FLAG_UNWRAP, + NULL, phi1, NULL); + if(res != RES_OK) + goto exit_label; + for(k = 0; k < n; k++) + tau[k] = (phi0[k] - phi1[k])/(w1[k] - w0[k]); + } + exit_label: - if(hc) - free(hc); - if(phi0) - free(phi0); - if(phi1) - free(phi1); - if(w0) - free(w0); - if(w1) - free(w1); - return res; + if(hc) + free(hc); + if(phi0) + free(phi0); + if(phi1) + free(phi1); + if(w0) + free(w0); + if(w1) + free(w1); + return res; } @@ -260,80 +329,80 @@ exit_label: -/************************************************************************************************** +/******************************************************************************* Complex frequency response of a digital filter H(z) -**************************************************************************************************/ -int DSPL_API freqz(double* b, double* a, int ord, double* w, int n, complex_t *h) +*******************************************************************************/ +int DSPL_API freqz(double* b, double* a, int ord, double* w, + int n, complex_t *h) { - - complex_t jw; - complex_t *bc = NULL; - complex_t *ac = NULL; - complex_t num, den; - double mag; - int k; - int res; - - if(!b || !w || !h) - return ERROR_PTR; - if(ord<0) - return ERROR_FILTER_ORD; - if(n<1) - return ERROR_SIZE; - - - bc = (complex_t*) malloc((ord+1) * sizeof(complex_t)); - res = re2cmplx(b, ord+1, bc); - if( res!=RES_OK ) - goto exit_label; - - if(a) - { - // IIR filter if a != NULL - ac = (complex_t*) malloc((ord+1) * sizeof(complex_t)); - res = re2cmplx(a, ord+1, ac); - if( res!=RES_OK ) - goto exit_label; - for(k = 0; k < n; k++) - { - RE(jw) = cos(w[k]); - IM(jw) = -sin(w[k]); - res = polyval_cmplx(bc, ord, &jw, 1, &num); - if(res != RES_OK) - goto exit_label; - res = polyval_cmplx(ac, ord, &jw, 1, &den); - if(res != RES_OK) - goto exit_label; - mag = ABSSQR(den); - if(mag == 0.0) - { - res = ERROR_DIV_ZERO; - goto exit_label; - } - mag = 1.0 / mag; - RE(h[k]) = CMCONJRE(num, den) * mag; - IM(h[k]) = CMCONJIM(num, den) * mag; - } - } - else - { - // FIR filter if a == NULL - for(k = 0; k < n; k++) - { - RE(jw) = cos(w[k]); - IM(jw) = -sin(w[k]); - res = polyval_cmplx(bc, ord, &jw, 1, h+k); - if(res != RES_OK) - goto exit_label; - } - } - res = RES_OK; + complex_t jw; + complex_t *bc = NULL; + complex_t *ac = NULL; + complex_t num, den; + double mag; + int k; + int res; + + if(!b || !w || !h) + return ERROR_PTR; + if(ord<0) + return ERROR_FILTER_ORD; + if(n<1) + return ERROR_SIZE; + + + bc = (complex_t*) malloc((ord+1) * sizeof(complex_t)); + res = re2cmplx(b, ord+1, bc); + if( res!=RES_OK ) + goto exit_label; + + if(a) + { + // IIR filter if a != NULL + ac = (complex_t*) malloc((ord+1) * sizeof(complex_t)); + res = re2cmplx(a, ord+1, ac); + if( res!=RES_OK ) + goto exit_label; + for(k = 0; k < n; k++) + { + RE(jw) = cos(w[k]); + IM(jw) = -sin(w[k]); + res = polyval_cmplx(bc, ord, &jw, 1, &num); + if(res != RES_OK) + goto exit_label; + res = polyval_cmplx(ac, ord, &jw, 1, &den); + if(res != RES_OK) + goto exit_label; + mag = ABSSQR(den); + if(mag == 0.0) + { + res = ERROR_DIV_ZERO; + goto exit_label; + } + mag = 1.0 / mag; + RE(h[k]) = CMCONJRE(num, den) * mag; + IM(h[k]) = CMCONJIM(num, den) * mag; + } + } + else + { + // FIR filter if a == NULL + for(k = 0; k < n; k++) + { + RE(jw) = cos(w[k]); + IM(jw) = -sin(w[k]); + res = polyval_cmplx(bc, ord, &jw, 1, h+k); + if(res != RES_OK) + goto exit_label; + } + } + res = RES_OK; exit_label: - if(bc) - free(bc); - if(ac) - free(ac); - return res; + if(bc) + free(bc); + if(ac) + free(ac); + return res; } @@ -343,9 +412,9 @@ exit_label: -/************************************************************************************************** +/******************************************************************************* Unwrap function -**************************************************************************************************/ +*******************************************************************************/ int DSPL_API unwrap(double* phi, int n, double lev, double mar) { double a[2] = {0.0, 0.0}; diff --git a/dspl/src/inout.c b/dspl/src/inout.c index 4a9814c..bfe395d 100644 --- a/dspl/src/inout.c +++ b/dspl/src/inout.c @@ -25,15 +25,15 @@ -/************************************************************************************************** +/******************************************************************************* Print DSPL info -**************************************************************************************************/ +*******************************************************************************/ void DSPL_API dspl_info() { - printf("\n\n D S P L - 2.0\n"); - printf(" version 2.18.5.3\n"); - printf("\n Сopyright (C) 2015-2018\n"); - printf(" Sergey Bakhurin www.dsplib.org\n\n"); + printf("\n\n D S P L - 2.0\n"); + printf(" version 2.18.6.14\n"); + printf("\n Сopyright (C) 2015-2018\n"); + printf(" Sergey Bakhurin www.dsplib.org\n\n"); } @@ -41,9 +41,9 @@ void DSPL_API dspl_info() -/************************************************************************************************** +/****************************************************************************** Write a real array to the binary file "fn" -***************************************************************************************************/ +*******************************************************************************/ int DSPL_API writebin(void* x, int n, int dtype, char* fn) { int k, res; @@ -59,52 +59,53 @@ int DSPL_API writebin(void* x, int n, int dtype, char* fn) pFile = fopen(fn, "wb"); if(pFile == NULL) return ERROR_FOPEN; - + if(fwrite(&dtype, sizeof(int), 1, pFile) != 1) - { - res = ERROR_FWRITE_SIZE; - goto exit_label; - } + { + res = ERROR_FWRITE_SIZE; + goto exit_label; + } - if(fwrite(&n, sizeof(int), 1, pFile) != 1) - { - res = ERROR_FWRITE_SIZE; - goto exit_label; - } + if(fwrite(&n, sizeof(int), 1, pFile) != 1) + { + res = ERROR_FWRITE_SIZE; + goto exit_label; + } k = 1; if(fwrite(&k, sizeof(int), 1, pFile) != 1) - { - res = ERROR_FWRITE_SIZE; - goto exit_label; - }; - - switch(dtype) - { - case DAT_DOUBLE: - if(fwrite((double*)x, sizeof(double), n, pFile) != n) - { - res = ERROR_FWRITE_SIZE; - goto exit_label; - } - break; - case DAT_COMPLEX: - if(fwrite((complex_t*)x, sizeof(complex_t), n, pFile) != n) - { - res = ERROR_FWRITE_SIZE; - goto exit_label; - } - break; - default: - res = ERROR_DAT_TYPE; - goto exit_label; - } - res = RES_OK; + { + res = ERROR_FWRITE_SIZE; + goto exit_label; + }; + + switch(dtype) + { + case DAT_DOUBLE: + if(fwrite((double*)x, sizeof(double), n, pFile) != n) + { + res = ERROR_FWRITE_SIZE; + goto exit_label; + } + break; + case DAT_COMPLEX: + if(fwrite((complex_t*)x, + sizeof(complex_t), n, pFile) != n) + { + res = ERROR_FWRITE_SIZE; + goto exit_label; + } + break; + default: + res = ERROR_DAT_TYPE; + goto exit_label; + } + res = RES_OK; exit_label: - if(pFile) - fclose(pFile); + if(pFile) + fclose(pFile); return res; } @@ -113,9 +114,9 @@ exit_label: -/************************************************************************************************** +/****************************************************************************** Write a real arrays to the text file "fn" -***************************************************************************************************/ +*******************************************************************************/ int DSPL_API writetxt(double* x, double *y, int n, char* fn) { int k; @@ -144,3 +145,71 @@ int DSPL_API writetxt(double* x, double *y, int n, char* fn) } + + + + +/****************************************************************************** + * Write a 3d plot data to file "fn" (pgfplots3d accepteble) + ******************************************************************************/ +int DSPL_API writetxt_3d(double* x, int nx, double *y, int ny, + double* z, char* fn) +{ + int k, n; + FILE* pFile = NULL; + + if(!x || !y || !z) + return ERROR_PTR; + if(nx < 1 || ny < 1) + return ERROR_SIZE; + if(!fn) + return ERROR_FNAME; + + pFile = fopen(fn, "w+"); + if(pFile == NULL) + return ERROR_FOPEN; + + for(k = 0; k < ny; k++) + { + for(n = 0; n < nx; n++) + fprintf(pFile, "%+.12E\t%+.12E\t%+.12E\n", + x[n], y[k], z[n+k*nx]); + fprintf(pFile, "\n"); + + } + fclose(pFile); + return RES_OK; +} + + + + + + + +/****************************************************************************** + * Write a 3d line data to file "fn" (pgfplots3d accepteble) + ******************************************************************************/ +int DSPL_API writetxt_3dline(double* x, double *y, double* z, int n, char* fn) +{ + int k; + FILE* pFile = NULL; + + if(!x || !y || !z) + return ERROR_PTR; + if(n < 1) + return ERROR_SIZE; + if(!fn) + return ERROR_FNAME; + + pFile = fopen(fn, "w+"); + if(pFile == NULL) + return ERROR_FOPEN; + + for(k = 0; k < n; k++) + fprintf(pFile, "%+.12E\t%+.12E\t%+.12E\n", x[k], y[k], z[k]); + fprintf(pFile, "\n"); + fclose(pFile); + return RES_OK; +} + diff --git a/include/dspl.c b/include/dspl.c index 081392b..0df3904 100644 --- a/include/dspl.c +++ b/include/dspl.c @@ -85,6 +85,7 @@ p_flipip_cmplx flipip_cmplx ; p_fourier_series_dec fourier_series_dec ; p_fourier_series_rec fourier_series_rec ; p_freqs freqs ; +p_freqs_cmplx freqs_cmplx ; p_freqs_resp freqs_resp ; p_freqs2time freqs2time ; p_freqz freqz ; @@ -107,6 +108,8 @@ p_trapint_cmplx trapint_cmplx ; p_unwrap unwrap ; p_writebin writebin ; p_writetxt writetxt ; +p_writetxt_3d writetxt_3d ; +p_writetxt_3dline writetxt_3dline ; #endif //BUILD_LIB @@ -209,6 +212,7 @@ void* dspl_load() LOAD_FUNC(fourier_series_rec); LOAD_FUNC(freqz); LOAD_FUNC(freqs); + LOAD_FUNC(freqs_cmplx); LOAD_FUNC(freqs_resp); LOAD_FUNC(freqs2time); LOAD_FUNC(goertzel); @@ -230,6 +234,8 @@ void* dspl_load() LOAD_FUNC(unwrap); LOAD_FUNC(writebin); LOAD_FUNC(writetxt); + LOAD_FUNC(writetxt_3d); + LOAD_FUNC(writetxt_3dline); #ifdef WIN_OS diff --git a/include/dspl.h b/include/dspl.h index 0fcb5f4..f4e1ef7 100644 --- a/include/dspl.h +++ b/include/dspl.h @@ -460,6 +460,13 @@ DECLARE_FUNC(int, freqs, double* COMMA int COMMA complex_t*); //------------------------------------------------------------------------------ +DECLARE_FUNC(int, freqs_cmplx, double* b + COMMA double* a + COMMA int ord + COMMA complex_t* s + COMMA int n + COMMA complex_t* h); +//------------------------------------------------------------------------------ DECLARE_FUNC(int, freqs_resp, double* COMMA double* COMMA int @@ -584,7 +591,19 @@ DECLARE_FUNC(int, writetxt, double* COMMA int COMMA char*); //------------------------------------------------------------------------------ - +DECLARE_FUNC(int, writetxt_3d, double* x + COMMA int nx + COMMA double* y + COMMA int ny + COMMA double* z + COMMA char* fn); +//------------------------------------------------------------------------------ +DECLARE_FUNC(int, writetxt_3dline, double* x + COMMA double* y + COMMA double* z + COMMA int n + COMMA char* fn); +//------------------------------------------------------------------------------ #ifdef __cplusplus } diff --git a/release/include/dspl.c b/release/include/dspl.c index 081392b..0df3904 100644 --- a/release/include/dspl.c +++ b/release/include/dspl.c @@ -85,6 +85,7 @@ p_flipip_cmplx flipip_cmplx ; p_fourier_series_dec fourier_series_dec ; p_fourier_series_rec fourier_series_rec ; p_freqs freqs ; +p_freqs_cmplx freqs_cmplx ; p_freqs_resp freqs_resp ; p_freqs2time freqs2time ; p_freqz freqz ; @@ -107,6 +108,8 @@ p_trapint_cmplx trapint_cmplx ; p_unwrap unwrap ; p_writebin writebin ; p_writetxt writetxt ; +p_writetxt_3d writetxt_3d ; +p_writetxt_3dline writetxt_3dline ; #endif //BUILD_LIB @@ -209,6 +212,7 @@ void* dspl_load() LOAD_FUNC(fourier_series_rec); LOAD_FUNC(freqz); LOAD_FUNC(freqs); + LOAD_FUNC(freqs_cmplx); LOAD_FUNC(freqs_resp); LOAD_FUNC(freqs2time); LOAD_FUNC(goertzel); @@ -230,6 +234,8 @@ void* dspl_load() LOAD_FUNC(unwrap); LOAD_FUNC(writebin); LOAD_FUNC(writetxt); + LOAD_FUNC(writetxt_3d); + LOAD_FUNC(writetxt_3dline); #ifdef WIN_OS diff --git a/release/include/dspl.h b/release/include/dspl.h index 0fcb5f4..f4e1ef7 100644 --- a/release/include/dspl.h +++ b/release/include/dspl.h @@ -460,6 +460,13 @@ DECLARE_FUNC(int, freqs, double* COMMA int COMMA complex_t*); //------------------------------------------------------------------------------ +DECLARE_FUNC(int, freqs_cmplx, double* b + COMMA double* a + COMMA int ord + COMMA complex_t* s + COMMA int n + COMMA complex_t* h); +//------------------------------------------------------------------------------ DECLARE_FUNC(int, freqs_resp, double* COMMA double* COMMA int @@ -584,7 +591,19 @@ DECLARE_FUNC(int, writetxt, double* COMMA int COMMA char*); //------------------------------------------------------------------------------ - +DECLARE_FUNC(int, writetxt_3d, double* x + COMMA int nx + COMMA double* y + COMMA int ny + COMMA double* z + COMMA char* fn); +//------------------------------------------------------------------------------ +DECLARE_FUNC(int, writetxt_3dline, double* x + COMMA double* y + COMMA double* z + COMMA int n + COMMA char* fn); +//------------------------------------------------------------------------------ #ifdef __cplusplus }