diff options
author | siddhu8990 | 2017-06-21 15:46:02 +0530 |
---|---|---|
committer | siddhu8990 | 2017-06-21 15:46:02 +0530 |
commit | cae632f23980b28f814dc9441df40032c8a4c1aa (patch) | |
tree | 39f70e6c4f694247f6b2c4e5db6fdb1e507b9408 /2.3-1/src/c/signalProcessing | |
parent | 9abc909f1a02c7c0262e2d53b13504c7ee324fda (diff) | |
parent | 56aa185002761d966abebb5c67e6c1a2d5ee141c (diff) | |
download | Scilab2C-cae632f23980b28f814dc9441df40032c8a4c1aa.tar.gz Scilab2C-cae632f23980b28f814dc9441df40032c8a4c1aa.tar.bz2 Scilab2C-cae632f23980b28f814dc9441df40032c8a4c1aa.zip |
Merged Ankit's work, signal processing and string functions
Diffstat (limited to '2.3-1/src/c/signalProcessing')
63 files changed, 2249 insertions, 0 deletions
diff --git a/2.3-1/src/c/signalProcessing/%k/dmodka.c b/2.3-1/src/c/signalProcessing/%k/dmodka.c new file mode 100644 index 00000000..c0630ec0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%k/dmodka.c @@ -0,0 +1,97 @@ +#include<stdio.h> +#include<math.h> +#include "modk.h" +double max_calc(double* ptr,int sz) +{ + int i=0; + double mx; + if(ptr[0]<0) + { + ptr[0]=-1*ptr[0]; + } + mx=(ptr[0]); + //printf("%lf\n",mx); + for(i=1;i<sz;i++) + { + if(ptr[i]<0) + { + ptr[i]=-1*ptr[i]; + } + if(mx<(ptr[i])) + mx=(ptr[i]); + } + return mx; +} +void dmodka(double* inp,int size,double* oup) +{ + double ones[size],PI=M_PI; + double eps=pow(2,-52); + int i; + for(i=0;i<size;i++) + { + ones[i]=1; + } + double a[size],b[size],c[size],an[size],bn[size],cn[size],kans[size]; + + int j,kk,l,m; + for(j=0;j<size;j++) + { + a[j]=1; + } + for(kk=0;kk<size;kk++) + { + b[kk]=sqrt(ones[kk]-inp[kk]); + } + for(l=0;l<size;l++) + { + c[l]=sqrt(inp[l]); + + } + int x=0; + //double maxi; + //maxi=max_calc(c,size); + //printf("%lf",maxi); + + while(max_calc(c,size)>eps) + { + int q,w,r; + for(q=0;q<size;q++) + { + an[q]=0.5*(a[q]+b[q]); + } + for(w=0;w<size;w++) + { + bn[w]=sqrt(a[w]*b[w]); + } + for(r=0;r<size;r++) + { + cn[r]=0.5*(a[r]-b[r]); + } + int x,y,z; + for(x=0;x<size;x++) + { + a[x]=an[x]; + } + for(y=0;y<size;y++) + { + b[y]=bn[y]; + } + for(z=0;z<size;z++) + { + c[z]=cn[z]; + } + } + int q,w; + for(q=0;q<size;q++) + { + oup[q]=PI*(ones[q]/(2*a[q])); + } + +} +/* +int main() +{ + double m[3]={0.1,0.2,0.3}; + dka(m,3); +} +*/ diff --git a/2.3-1/src/c/signalProcessing/%k/int_modk.h b/2.3-1/src/c/signalProcessing/%k/int_modk.h new file mode 100644 index 00000000..ae09c50a --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%k/int_modk.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_%K_H__ +#define __INT_%K_H__ + +#define d2modkz2(inp,size,oup) dmodka(inp,size,oup) + +#endif /* !INT_%K_H__! */ diff --git a/2.3-1/src/c/signalProcessing/%k/modk.h b/2.3-1/src/c/signalProcessing/%k/modk.h new file mode 100644 index 00000000..6b4a7e08 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%k/modk.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __%K_H__ +#define __%K_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmodka(double* inp,int size,doubleComplex* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __%K_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/%sn/dmodsna.c b/2.3-1/src/c/signalProcessing/%sn/dmodsna.c new file mode 100644 index 00000000..7e1e81c3 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/dmodsna.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "modsn.h" + +void dmodsna(double* uu,int size,double emmc,double* sn) +{ + int i; + for(i=0;i<size;i++) + { + sn[i]=dmodsns(uu[i],emmc); + } +} + diff --git a/2.3-1/src/c/signalProcessing/%sn/dmodsns.c b/2.3-1/src/c/signalProcessing/%sn/dmodsns.c new file mode 100644 index 00000000..06d0a6f0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/dmodsns.c @@ -0,0 +1,93 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + Reference:- Abramowitz, Milton and Stegun, Irene A + Handbook of Mathematical Functions, Dover, 1965 + Chapter 16 (Sections 16.4, 16.13 and 16.15) + Link for FORTRAN code:-http://www.aip.de/groups/soe/local/numres/bookfpdf/f6-11.pdf +*/ + +#include<stdio.h> +#include<math.h> +#define CA 0.0003 +#include "modsn.h" +double dmodsns(double uu, double emmc) +{ + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + double sn,cn,dn; + emc=1-emmc; + u=uu; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + dn=1.0; + for(i=1;i<=13;i++) + { + l=i; + em[i]=a; + en[i]=(emc=sqrt(emc)); + c=0.5*(a+emc); + if(fabs(a-emc)<=CA*a)break; + emc*=a; + a=c; + } + u*=c; + sn=sin(u); + cn=cos(u); + if(sn) + { + a=cn/sn; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=dn; + dn=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + sn=(sn>=0.0?a:-a); + cn=c*(sn); + } + if(bo) + { + a=dn; + dn=cn; + cn=a; + sn/=d; + } + } + else + { + cn=1.0/cosh(u); + dn=cn; + sn=tanh(u); + } + return sn; +} +/* +int main() +{ + double u,k; + u=4; + k=0.7; + sn(u,k); +} +*/ diff --git a/2.3-1/src/c/signalProcessing/%sn/int_modsn.h b/2.3-1/src/c/signalProcessing/%sn/int_modsn.h new file mode 100644 index 00000000..179fb61f --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/int_modsn.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_MODSN_H__ +#define __INT_MODSN_H__ + +#define d0d0modsnd0(uu,emmc) dmodsns(uu,emmc) + +#endif /* !INT_MODSN_H__! */ diff --git a/2.3-1/src/c/signalProcessing/%sn/modsn.h b/2.3-1/src/c/signalProcessing/%sn/modsn.h new file mode 100644 index 00000000..c5896562 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/modsn.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __MODSN_H__ +#define __MODSN_H__ +#include "types.h" + +#ifdef __cplusplus +extern "c" { +#endif + +double dmodsns(double uu, double emmc); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODSN_H__ */ diff --git a/2.3-1/src/c/signalProcessing/%sn/zmodsna.c b/2.3-1/src/c/signalProcessing/%sn/zmodsna.c new file mode 100644 index 00000000..33052a32 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/zmodsna.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "modsn.h" +#include "doubleComplex.h" + +void zmodsna(doubleComplex* uu,int size,double emmc,doubleComplex* sn) +{ + int i; + for(i=0;i<size;i++) + { + sn[i]=zmodsns(uu[i],emmc); + } +} diff --git a/2.3-1/src/c/signalProcessing/%sn/zmodsns.c b/2.3-1/src/c/signalProcessing/%sn/zmodsns.c new file mode 100644 index 00000000..5f35059f --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/zmodsns.c @@ -0,0 +1,161 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + Reference:- Abramowitz, Milton and Stegun, Irene A + Handbook of Mathematical Functions, Dover, 1965 + Chapter 16 (Sections 16.4, 16.13 and 16.15) + Link for FORTRAN code:-http://www.aip.de/groups/soe/local/numres/bookfpdf/f6-11.pdf +*/ + +#include<stdio.h> +#include<math.h> +#include "modsn.h" +#include "doubleComplex.h" +#define CA 0.0003 + +doubleComplex zmodsns(doubleComplex uu,double emmc) +{ + doubleComplex ans; + double uur,uui; + uur=zreals(uu); + uui=zimags(uu); + double sr,cr,dr; + //Performing Elliptic Function operation for the real values + double a1,b1,c1,d1,emc1,u1; + double em1[14],en1[14]; + int i1,ii1,l1,bo1; + emc1=1-emmc; + u1=uur; + if(emc1) + { + bo1=(emc1<0.0); + if(bo1) + { + d1=1.0-emc1; + emc1/=-1.0/d1; + u1*=(d1=sqrt(d1)); + } + a1=1.0; + dr=1.0; + for(i1=1;i1<=13;i1++) + { + l1=i1; + em1[i1]=a1; + en1[i1]=(emc1=sqrt(emc1)); + c1=0.5*(a1+emc1); + if(fabs(a1-emc1)<=CA*a1)break; + emc1*=a1; + a1=c1; + } + u1*=c1; + sr=sin(u1); + cr=cos(u1); + if(sr) + { + a1=cr/sr; + c1*=a1; + for(ii1=l1;ii1>=1;ii1--) + { + b1=em1[ii1]; + a1*=c1; + c1*=dr; + dr=(en1[ii1]+a1)/(b1+a1); + a1=c1/b1; + } + a1=1.0/sqrt(c1*c1+1.0); + sr=(sr>=0.0?a1:-a1); + cr=c1*(sr); + } + if(bo1) + { + a1=dr; + dr=cr; + cr=a1; + sr/=d1; + } + } + else + { + cr=1.0/cosh(u1); + dr=cr; + sr=tanh(u1); + } + //////////////////////////////////////////////////////////////// + double si,ci,di; + //Performing Elleptic Function operation for the imaginary values + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + //double s1,c1,d1; + emc=emmc; + u=uui; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + di=1.0; + for(i=1;i<=13;i++) + { + l=i; + em[i]=a; + en[i]=(emc=sqrt(emc)); + c=0.5*(a+emc); + if(fabs(a-emc)<=CA*a)break; + emc*=a; + a=c; + } + u*=c; + si=sin(u); + ci=cos(u); + if(si) + { + a=ci/si; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=di; + di=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + si=(si>=0.0?a:-a); + ci=c*(si); + } + if(bo) + { + a=di; + di=ci; + ci=a; + si/=d; + } + } + else + { + ci=1.0/cosh(u); + di=ci; + si=tanh(u); + } + ///////////////////////////////////////////////////////// + double delta; + delta=ci*ci + emmc*sr*sr*si*si; + double snir,snii; + snir=(sr*di)/delta; + snii=(cr*dr*si*ci)/delta; + ans=DoubleComplex(snir,snii); + return ans; +} diff --git a/2.3-1/src/c/signalProcessing/buttmag/buttmag.h b/2.3-1/src/c/signalProcessing/buttmag/buttmag.h new file mode 100644 index 00000000..47e64af8 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/buttmag.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __BUTTMAG_H__ +#define __BUTTMAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dbuttmags(double order, double omegac, int size, double* sample,double* out); + +#ifdef __cplusplus +} /* extern "C"*/ +#endif + +#endif /* __BUTTMAG_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/buttmag/dbuttmags.c b/2.3-1/src/c/signalProcessing/buttmag/dbuttmags.c new file mode 100644 index 00000000..dc40e814 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/dbuttmags.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include<stdio.h> +#include<math.h> +#include "buttmag.h" +void dbuttmags(double order, double omegac,double* sample,int size,double* out) +{ + double ones[size]; + int j,k; + for(j=0;j<size;j++) + { + ones[j]=1.0; + } + //double h[size]; + for(k=0;k<size;k++) + { + double x=ones[k]/(ones[k]+pow((sample[k]/omegac),(2*order))); + out[k]=x; + //printf("%lf\n",h[k]); + } + +} + diff --git a/2.3-1/src/c/signalProcessing/buttmag/int_buttmag.h b/2.3-1/src/c/signalProcessing/buttmag/int_buttmag.h new file mode 100644 index 00000000..9867438e --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/int_buttmag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_BUTTMAG_H__ +#define __INT_BUTTMAG_H__ + +#define d0d0d2buttmagd2(order,omegac,size,sample,out) dbuttmags(order,omegac,size,sample,out) + +#endif /* !INT_BUTTMAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/buttmag/u8buttmags.c b/2.3-1/src/c/signalProcessing/buttmag/u8buttmags.c new file mode 100644 index 00000000..e7b52c22 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/u8buttmags.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include<stdio.h> +#include<math.h> +#include "buttmag.h" +void dbuttmags(int order, int omegac,double* sample,int size,double* out) +{ + double ones[size]; + int j,k; + for(j=0;j<size;j++) + { + ones[j]=1.0; + } + //double h[size]; + for(k=0;k<size;k++) + { + double x=ones[k]/(ones[k]+pow((sample[k]/omegac),(2*order))); + out[k]=x; + //printf("%lf\n",h[k]); + } + +} + diff --git a/2.3-1/src/c/signalProcessing/cheb1mag/cheb1mag.h b/2.3-1/src/c/signalProcessing/cheb1mag/cheb1mag.h new file mode 100644 index 00000000..369ee4ce --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb1mag/cheb1mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB1MAG_H__ +#define __CHEB1MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB1MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/cheb1mag/dcheb1mags.c b/2.3-1/src/c/signalProcessing/cheb1mag/dcheb1mags.c new file mode 100644 index 00000000..a4a459d4 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb1mag/dcheb1mags.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "cheb1mag.h" +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out) +{ + double x; + int j; + double tn; + for(j=0;j<size;j++) + { + x=sample[j]/omegac; + if(x<=1) + { + tn=cos(n*acos(x)); + out[j]=1/(1+(epsilon*epsilon)*(tn*tn)); + } + else + { + tn=cosh(n*acosh(x)); + out[j]=1/(1+(epsilon*epsilon)*(tn*tn)); + } + } +} + diff --git a/2.3-1/src/c/signalProcessing/cheb1mag/int_cheb1mag.h b/2.3-1/src/c/signalProcessing/cheb1mag/int_cheb1mag.h new file mode 100644 index 00000000..fa0ff83e --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb1mag/int_cheb1mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB1MAG_H__ +#define __INT_CHEB1MAG_H__ + +#define d0d0d2cheb1magd2(n,omegac,epsilon,sample,size,out) dcheb1mags(n,omegac,epsilon,sample,size,out) + +#endif /* !__INT_CHEB1MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/cheb2mag/cheb2mag.h b/2.3-1/src/c/signalProcessing/cheb2mag/cheb2mag.h new file mode 100644 index 00000000..0516ca51 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb2mag/cheb2mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB2MAG_H__ +#define __CHEB2MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB2MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/cheb2mag/dcheb2mags.c b/2.3-1/src/c/signalProcessing/cheb2mag/dcheb2mags.c new file mode 100644 index 00000000..006c5917 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb2mag/dcheb2mags.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "cheb2mag.h" +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup) +{ + double e; + //e=sqrt(A*A-1); + e=1/(pow(10,A/10)-1); + double x,k,cn,h,tp; + int i; + for(i=0;i<size;i++) + { + x=omegar/sample[i]; + if(x<=1) + { + tp=acos(x); + cn=cos(n*tp); + if(x==1) + { + h=1/(1+A*A-1); + } + else + { + h=1/(1+((A*A-1)/(cn*cn))); + } + + } + else + { + tp=acosh(x); + cn=cosh(n*tp); + h=e*(cn*cn)/(1+e*(cn*cn)); + + } + oup[i]=h; + } +} + diff --git a/2.3-1/src/c/signalProcessing/cheb2mag/int_cheb2mag.h b/2.3-1/src/c/signalProcessing/cheb2mag/int_cheb2mag.h new file mode 100644 index 00000000..05b77c2d --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb2mag/int_cheb2mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB2MAG_H__ +#define __INT_CHEB2MAG_H__ + +#define d0d0d0d2cheb2magd2(n,omegar,A,sample,size,oup) dcheb2mag(n,omegar,A,sample,size,oup) + +#endif /* !__INT_CHEB2MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/ffilt/ffilt.h b/2.3-1/src/c/signalProcessing/ffilt/ffilt.h new file mode 100644 index 00000000..9b98f34c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ffilt/ffilt.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FFILT_H__ +#define __FFILT_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gffilts(char* ft,double N,double fc,double fh,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FFILT_H__ */ diff --git a/2.3-1/src/c/signalProcessing/ffilt/gffilts.c b/2.3-1/src/c/signalProcessing/ffilt/gffilts.c new file mode 100644 index 00000000..538daf3e --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ffilt/gffilts.c @@ -0,0 +1,90 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "filt_sinc.h" +#include "ffilt.h" +void gffilts(char* ft,int size,double N,double fc,double fh,double* oup) +{ + int sz=N; + double X[sz]; + double no22=(N-1)/2; + int ino22=(int)no22; + if(ft[0]=='l') + { + dfilt_sincs(N,fc,X); + int k=0; + for(k=0;k<sz;k++) + { + oup[k]=X[k]; + } + } + else if(ft[0]=='h') + { + int k=0; + dfilt_sincs(N,fc,X); + for(k=0;k<sz;k++) + { + oup[k]=-1*X[k]; + } + int id=no22; + oup[id]=1+oup[id]; + } + else if(ft[0]=='b') + { + double wc=M_PI*(fh+fc); + fc=(fh-fc)/2; + dfilt_sincs(N,fc,X); + double Y[sz]; + double k=0; + for(k=-no22;k<=no22;k++) + { + int ind; + ind=k+no22; + Y[ind]=2*cos(wc*k); + } + int j=0; + for(j=0;j<sz;j++) + { + oup[j]=X[j]*Y[j]; + } + } + else if(ft[0]=='s') + { + double wc=M_PI*(fh+fc); + fc=(fh-fc)/2; + dfilt_sincs(N,fc,X); + double Y[sz]; + double k=0; + for(k=-no22;k<=no22;k++) + { + int ind; + ind=k+no22; + Y[ind]=2*cos(wc*k); + } + int j=0; + for(j=0;j<sz;j++) + { + oup[j]=-1*X[j]*Y[j]; + } + int id=no22; + oup[id]=1+oup[id]; + } +} +/* +int main() +{ + string s; + int n; + double fl,fh; +} +*/ diff --git a/2.3-1/src/c/signalProcessing/ffilt/int_ffilt.h b/2.3-1/src/c/signalProcessing/ffilt/int_ffilt.h new file mode 100644 index 00000000..83f44827 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ffilt/int_ffilt.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FFILT_H__ +#define __INT_FFILT_H__ + +#define g0d0d0d0ffiltd2(ft,N,fc,fh,oup) gffilts(ft,N,fc,fh,oup) + +#endif /* !__INT_FFILT_H__! */ diff --git a/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c b/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c new file mode 100644 index 00000000..65aaaa65 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c @@ -0,0 +1,58 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "filt_sinc.h" +void dfilt_sincs(double N,double fc,double* oup) +{ + double no2=(N-1)/2; + int ino2=(int)no2; + double wl=fc*2*M_PI; + int sz=N; + double xn[sz]; + double i; + int l,m; + for(i=-no2;i<=no2;i++) + { + l=i+no2; + xn[l]=sin(wl*i); + } + double xd[sz]; + double j; + printf("\n"); + for(j=-no2;j<=no2;j++) + { + m=j+no2; + xd[m]=M_PI*j; + } + if(ino2==no2) + { + xn[(int)no2]=2*fc; + xd[(int)no2]=1; + } + double x[sz]; + int k; + for(k=0;k<N;k++) + { + oup[k]=xn[k]/xd[k]; + } +} +/* +int main() +{ + int n; + double fl; + n=5; + fl=0.2; + filt_sinc(n,fl); +} +*/ diff --git a/2.3-1/src/c/signalProcessing/filt_sinc/filt_sinc.h b/2.3-1/src/c/signalProcessing/filt_sinc/filt_sinc.h new file mode 100644 index 00000000..43b24151 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/filt_sinc/filt_sinc.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FILT_SINC_H__ +#define __FILT_SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8filt_sincs(int N,double fc,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FILT_SINC_H */ + diff --git a/2.3-1/src/c/signalProcessing/filt_sinc/int_filt_sinc.h b/2.3-1/src/c/signalProcessing/filt_sinc/int_filt_sinc.h new file mode 100644 index 00000000..5b7b07ae --- /dev/null +++ b/2.3-1/src/c/signalProcessing/filt_sinc/int_filt_sinc.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FILT_SINC_H__ +#define __INT_FILT_SINC_H__ + +#define u80d0filt_sincd2(N,fc,oup) u8filt_sincs(N,fc,oup) + +#endif /* !__INT_FILT_SINC_H__! */ diff --git a/2.3-1/src/c/signalProcessing/fsfirlin/dfsfirlina.c b/2.3-1/src/c/signalProcessing/fsfirlin/dfsfirlina.c new file mode 100644 index 00000000..d2079f4d --- /dev/null +++ b/2.3-1/src/c/signalProcessing/fsfirlin/dfsfirlina.c @@ -0,0 +1,144 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> + +#include<math.h> +#include "sincd.h" +#include "fsfirlin.h" +//#define PI 3.14159265358979 + +void dfsfirlina(double* hd,int size,double flag,double* hst) +{ + int n1=size,n; + if( n1%2==0) + { + n=2*n1; + } + else + { + n=2*n1+1; + } + double scd[8*n+1]; + //STRAT SINCD + double npt=4*n; + int sz=4*n; + double PI=M_PI; + double pas=PI/npt; + double om[sz+1]; + int i; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flag==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + scd[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + scd[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + scd[m]=scd[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + scd[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + scd[l]=s[l-(sz)]/n; + } + } + //END SINCD + int ii; + for(ii=4*n;ii<=6*n;ii++) + { + hst[ii-(4*n)]=hd[0]*scd[ii]; + } + + int epsi; + epsi=pow(-1,n-1); + int jj; + for(jj=1;jj<=(n1-1);jj++) + { + double tp1[2*n+1]; + double tp2[2*n+1]; + int k,l; + for(k=(-4*jj+4*n);k<=(-4*jj+6*n);k++) + { + tp1[k-(-4*jj+4*n)]=hd[jj]*scd[k]; + } + + for(l=(4*jj);l<=(4*jj+2*n);l++) + { + tp2[l-(4*jj)]=hd[jj]*(epsi*scd[l]); + } + int m; + for(m=0;m<=2*n;m++) + { + hst[m]=hst[m]+(tp1[m]+tp2[m]); + } + + } + + +} diff --git a/2.3-1/src/c/signalProcessing/fsfirlin/fsfirlin.h b/2.3-1/src/c/signalProcessing/fsfirlin/fsfirlin.h new file mode 100644 index 00000000..7337cbfe --- /dev/null +++ b/2.3-1/src/c/signalProcessing/fsfirlin/fsfirlin.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FSFIRLIN_H__ +#define __FSFIRLIN_H__ +#include "types.h" +#include "sincd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfsfirlina(double* hd,int size,int flag,double* hst); + +#ifdef __cplusplus +} /* extern "C" */ +#endif diff --git a/2.3-1/src/c/signalProcessing/fsfirlin/int_fsfirlin.h b/2.3-1/src/c/signalProcessing/fsfirlin/int_fsfirlin.h new file mode 100644 index 00000000..857dae8c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/fsfirlin/int_fsfirlin.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FSFIRLIN_H__ +#define __INT_FSFIRLIN_H__ + +#define d2u80fsfirlind2(hd,size,flag,hst) dfsfirlina(hd,size[1],flag,hst) + +#endif /* !__INT_FSFIRLIN_H__! */ diff --git a/2.3-1/src/c/signalProcessing/includes/buttmag.h b/2.3-1/src/c/signalProcessing/includes/buttmag.h new file mode 100644 index 00000000..ef17b7ea --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/buttmag.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __BUTTMAG_H__ +#define __BUTTMAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dbuttmags(double order, double omegac, double* sample, int size,double* out); +void u8buttmags(int order, int omegac, double* sample, int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __BUTTMAG_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/includes/cheb1mag.h b/2.3-1/src/c/signalProcessing/includes/cheb1mag.h new file mode 100644 index 00000000..369ee4ce --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/cheb1mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB1MAG_H__ +#define __CHEB1MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB1MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/cheb2mag.h b/2.3-1/src/c/signalProcessing/includes/cheb2mag.h new file mode 100644 index 00000000..0516ca51 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/cheb2mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __CHEB2MAG_H__ +#define __CHEB2MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB2MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/ffilt.h b/2.3-1/src/c/signalProcessing/includes/ffilt.h new file mode 100644 index 00000000..f38df6e6 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/ffilt.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FFILT_H__ +#define __FFILT_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gffilts(char* ft,int size,double N,double fc,double fh,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FFILT_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/filt_sinc.h b/2.3-1/src/c/signalProcessing/includes/filt_sinc.h new file mode 100644 index 00000000..095ca91f --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/filt_sinc.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FILT_SINC_H__ +#define __FILT_SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfilt_sincs(double N,double fc,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FILT_SINC_H */ + diff --git a/2.3-1/src/c/signalProcessing/includes/fsfirlin.h b/2.3-1/src/c/signalProcessing/includes/fsfirlin.h new file mode 100644 index 00000000..cf5fbbd0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/fsfirlin.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __FSFIRLIN_H__ +#define __FSFIRLIN_H__ +#include "types.h" +#include "sincd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfsfirlina(double* hd,int size,double flag,double* hst); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__FSFIRLIN_H__*/ diff --git a/2.3-1/src/c/signalProcessing/includes/modsn.h b/2.3-1/src/c/signalProcessing/includes/modsn.h new file mode 100644 index 00000000..d91dd9d3 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/modsn.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __MODSN_H__ +#define __MODSN_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmodsns(double uu, double emmc); +doubleComplex zmodsns(doubleComplex uu,double emmc); +void dmodsna(double* uu,int size,double emmc,double* sn); +void zmodsna(doubleComplex* uu,int size,double emmc,doubleComplex* sn); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODSN_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/sincd.h b/2.3-1/src/c/signalProcessing/includes/sincd.h new file mode 100644 index 00000000..9b7a3607 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/sincd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SINCD_H__ +#define __SINCD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsincds(double n,double flg,double* oup); +void u8sincds(int n,int flg,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINCD_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/includes/zpbutt.h b/2.3-1/src/c/signalProcessing/includes/zpbutt.h new file mode 100644 index 00000000..9eb88ad4 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/zpbutt.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPBUTT_H__ +#define __ZPBUTT_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpbutts(double n,double fl,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPBUTT_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/includes/zpch1.h b/2.3-1/src/c/signalProcessing/includes/zpch1.h new file mode 100644 index 00000000..fbe850cc --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/zpch1.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH1_H__ +#define __ZPCH1_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch1s(double N,double e,double wc,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH1_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/zpch2.h b/2.3-1/src/c/signalProcessing/includes/zpch2.h new file mode 100644 index 00000000..d7c1c647 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/zpch2.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH2_H__ +#define __ZPCH2_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH2_H__ */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_buttmag.h b/2.3-1/src/c/signalProcessing/interfaces/int_buttmag.h new file mode 100644 index 00000000..4a33fafe --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_buttmag.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_BUTTMAG_H__ +#define __INT_BUTTMAG_H__ + +#define d0d0d2buttmagd2(order,omegac,sample,size,out) dbuttmags(order,omegac,sample,size[1],out) +#define u80u80d2buttmagd2(order,omegac,sample,size,out) u8buttmags(order,omegac,sample,size[1],out) + +#endif /* !INT_BUTTMAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_cheb1mag.h b/2.3-1/src/c/signalProcessing/interfaces/int_cheb1mag.h new file mode 100644 index 00000000..764e8c79 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_cheb1mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB1MAG_H__ +#define __INT_CHEB1MAG_H__ + +#define d0d0d0d2cheb1magd2(n,omegac,epsilon,sample,size,out) dcheb1mags(n,omegac,epsilon,sample,size[1],out) + +#endif /* !__INT_CHEB1MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_cheb2mag.h b/2.3-1/src/c/signalProcessing/interfaces/int_cheb2mag.h new file mode 100644 index 00000000..b63db04d --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_cheb2mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_CHEB2MAG_H__ +#define __INT_CHEB2MAG_H__ + +#define d0d0d0d2cheb2magd2(n,omegar,A,sample,size,oup) dcheb2mags(n,omegar,A,sample,size[1],oup) + +#endif /* !__INT_CHEB2MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_ffilt.h b/2.3-1/src/c/signalProcessing/interfaces/int_ffilt.h new file mode 100644 index 00000000..273b98f7 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_ffilt.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FFILT_H__ +#define __INT_FFILT_H__ + +#define g2d0d0d0ffiltd2(ft,size,N,fc,fh,oup) gffilts(ft,size[1],N,fc,fh,oup) + +#endif /* !__INT_FFILT_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_filt_sinc.h b/2.3-1/src/c/signalProcessing/interfaces/int_filt_sinc.h new file mode 100644 index 00000000..f90d0a62 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_filt_sinc.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FILT_SINC_H__ +#define __INT_FILT_SINC_H__ + +#define d0d0filt_sincd2(N,fc,oup) dfilt_sincs(N,fc,oup) + +#endif /* !__INT_FILT_SINC_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_fsfirlin.h b/2.3-1/src/c/signalProcessing/interfaces/int_fsfirlin.h new file mode 100644 index 00000000..3f6fb6e0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_fsfirlin.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_FSFIRLIN_H__ +#define __INT_FSFIRLIN_H__ + +#define d2d0fsfirlind2(hd,size,flag,hst) dfsfirlina(hd,size[1],flag,hst) + +#endif /* !__INT_FSFIRLIN_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h b/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h new file mode 100644 index 00000000..0d32eb06 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h @@ -0,0 +1,21 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_MODSN_H__ +#define __INT_MODSN_H__ + +#define d0d0modsnd0(uu,emmc) dmodsns(uu,emmc) +#define z0d0modsnz0(uu,emmc) zmodsns(uu,emmc) +#define d2d0modsnd2(uu,size,emmc,sn) dmodsna(uu,size[1],emmc,sn) +#define z2d0modsnz2(uu,size,emmc,sn) zmodsna(uu,size[1],emmc,sn) + +#endif /* !INT_MODSN_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_sincd.h b/2.3-1/src/c/signalProcessing/interfaces/int_sincd.h new file mode 100644 index 00000000..73136730 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_sincd.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SINCD_H__ +#define __INT_SINCD_H__ + +#define d0d0sincdd2(n,flg,oup) dsincds(n,flg,oup) +#define u80u80sincdd2(n,flg,oup) u8sincds(n,flg,oup) + +#endif /* !__INT_SINCD_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_zpbutt.h b/2.3-1/src/c/signalProcessing/interfaces/int_zpbutt.h new file mode 100644 index 00000000..775c1026 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_zpbutt.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPBUTT_H__ +#define __INT_ZPBUTT_H__ + +#define d0d0zpbuttz2d0(n,fl,out) dzpbutts(n,fl,out) + +#endif /* !INT_ZPBUTT_H__! */ + diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_zpch1.h b/2.3-1/src/c/signalProcessing/interfaces/int_zpch1.h new file mode 100644 index 00000000..429e7c36 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_zpch1.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH1_H__ +#define __INT_ZPCH1_H__ + +#define d0d0d0zpch1z2d0(N,e,wc,out) dzpch1s(N,e,wc,out) + +#endif /* !INT_ZPCH1_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_zpch2.h b/2.3-1/src/c/signalProcessing/interfaces/int_zpch2.h new file mode 100644 index 00000000..fcb12a7c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_zpch2.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH2_H__ +#define __INT_ZPCH2_H__ + +#define d0d0d0zpch2z2z2d0(N,A,omegar,zeros,poles) dzpch2s(N,A,omegar,zeros,poles) + +#endif /* !INT_ZPCH2_H__! */ diff --git a/2.3-1/src/c/signalProcessing/sincd/dsincds.c b/2.3-1/src/c/signalProcessing/sincd/dsincds.c new file mode 100644 index 00000000..1475d8de --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/dsincds.c @@ -0,0 +1,99 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include<math.h> +#include "sincd.h" +//#define PI 3.14159265358979 +void dsincds(double n,double flg,double* oup) +{ + double npt=4*n; + int sz=4*n; + double PI=M_PI; + double pas=PI/npt; + double om[sz+1]; + int i; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flg==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + oup[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + oup[m]=oup[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + oup[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]/n; + } + + } +} + diff --git a/2.3-1/src/c/signalProcessing/sincd/int_sincd.h b/2.3-1/src/c/signalProcessing/sincd/int_sincd.h new file mode 100644 index 00000000..a404978b --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/int_sincd.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_SINCD_H__ +#define __INT_SINCD_H__ + +#define u80sincdd2(n,flg,oup) u8sincds(n,flg,oup) + +#endif /* !__INT_SINCD_H__! */ diff --git a/2.3-1/src/c/signalProcessing/sincd/sincd.h b/2.3-1/src/c/signalProcessing/sincd/sincd.h new file mode 100644 index 00000000..2df85a87 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/sincd.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __SINCD_H__ +#define __SINCD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8sincds(int n,int flg,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINCD_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/sincd/u8sincds.c b/2.3-1/src/c/signalProcessing/sincd/u8sincds.c new file mode 100644 index 00000000..d03f48ae --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/u8sincds.c @@ -0,0 +1,98 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include<math.h> +#include "sincd.h" +#define PI 3.14159265358979 +void u8sincds(int n,int flg,double* oup) +{ + double npt=4*n; + int sz=4*n; + double pas=PI/npt; + double om[sz+1]; + int i; + //om[0]=0; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flg==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + oup[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + oup[m]=oup[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + oup[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]/n; + } + + } +} diff --git a/2.3-1/src/c/signalProcessing/zpbutt/dzpbutts.c b/2.3-1/src/c/signalProcessing/zpbutt/dzpbutts.c new file mode 100644 index 00000000..33f22af9 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpbutt/dzpbutts.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include<math.h> +#include "zpbutt.h" +#define PI 3.14159265 +double dzpbutts(double n,double fl,doubleComplex* out) +{ + double e= PI/(2.0*(n)); + int k; + double rl,cpx,gain; + for(k=1;k<=n;k++) + { + double v=2.0*(double)k+(n)-1.0; + rl=(fl)*cos(e*v); + cpx=(fl)*sin(e*v); + out[k-1]=DoubleComplex(rl,cpx); + } + gain=pow(fl,n); + +return gain; + +} + diff --git a/2.3-1/src/c/signalProcessing/zpbutt/int_zpbutt.h b/2.3-1/src/c/signalProcessing/zpbutt/int_zpbutt.h new file mode 100644 index 00000000..72eae8a2 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpbutt/int_zpbutt.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPBUTT_H__ +#define __INT_ZPBUTT_H__ + +#define d0d0zpbuttzada(n,fl,out,gain) dzpbutts(n,fl,out,gain) + +#endif /* !INT_ZPBUTT_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/zpbutt/zpbutt.h b/2.3-1/src/c/signalProcessing/zpbutt/zpbutt.h new file mode 100644 index 00000000..6883942c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpbutt/zpbutt.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPBUTT_H__ +#define __ZPBUTT_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dzpbutts(double* n,double* fl,doublecomplex* out,double* gain); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + diff --git a/2.3-1/src/c/signalProcessing/zpch1/dzpch1s.c b/2.3-1/src/c/signalProcessing/zpch1/dzpch1s.c new file mode 100644 index 00000000..ab7b6332 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch1/dzpch1s.c @@ -0,0 +1,53 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "zpch1.h" +#include "multiplication.h" +#include "conj.h" +#include "abs.h" +#define PI 3.14159265 +double dzpch1s(double N,double e,double wc,doubleComplex* out) +{ + doubleComplex accumulate,tp; + double B,r,R,gain,realVal; + double temp=sqrt(1+e*e); + + B=pow((temp+1)/e,1/N); + + r=wc*((B*B-1)/(2*B)); + R=wc*((B*B+1)/(2*B)); + + int k; + double t1=1; + double t2=0; + accumulate=DoubleComplex(t1,t2); + for(k=0;k<N;k++) + { + double theta; + theta=(PI/2)+((2*k+1)*PI)/(2*N); + double xk,yk; + xk=r*cos(theta); + yk=R*sin(theta); + out[k]=DoubleComplex(xk,yk); + tp=DoubleComplex(xk,yk); + accumulate=zmuls(accumulate,tp); + } + + realVal=zreals(accumulate); + gain=dabss(realVal); + if (N==2*(int)(N/2)) + gain=gain/sqrt(1+e*e); +return gain; + +} + diff --git a/2.3-1/src/c/signalProcessing/zpch1/int_zpch1.h b/2.3-1/src/c/signalProcessing/zpch1/int_zpch1.h new file mode 100644 index 00000000..8933d1a2 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch1/int_zpch1.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH1_H__ +#define __INT_ZPCH1_H__ + +#define d0d0d0zpch1z2d0(N,e,wc) dzpch1s(N,e,wc) + +#endif /* !INT_ZPCH1_H__! */ diff --git a/2.3-1/src/c/signalProcessing/zpch1/zpch1.h b/2.3-1/src/c/signalProcessing/zpch1/zpch1.h new file mode 100644 index 00000000..fbe850cc --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch1/zpch1.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH1_H__ +#define __ZPCH1_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch1s(double N,double e,double wc,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH1_H__ */ diff --git a/2.3-1/src/c/signalProcessing/zpch2/dzpch2s.c b/2.3-1/src/c/signalProcessing/zpch2/dzpch2s.c new file mode 100644 index 00000000..22a46a64 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch2/dzpch2s.c @@ -0,0 +1,63 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "zpch2.h" +#include "multiplication.h" +#include "abs.h" +#include "division.h" +#define PI 3.14159265 +double dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles) +{ + int k,j; + double e,xk,realVal,gain; + doubleComplex accumulate1,accumulate2,tp1,tp2; + accumulate1=DoubleComplex(1,0); + accumulate2=DoubleComplex(1,0); + int ct=0; + for(k=1;k<=N;k++) + { + if(k!=((N+1)/2)) + { + ct++; + double num=PI*(2*k-1); + double den=2*N; + xk=cos(num/den); + double sk=omegar/xk; + zeros[k-1]=DoubleComplex(0,sk); + tp1=DoubleComplex(0,sk); + accumulate1=zmuls(accumulate1,tp1); + } + } + for(j=1;j<=N;j++) + { + double num=PI*(2*j-1); + double den=2*N; + double xk1=num/den; + double Gamma=pow((A+sqrt(A*A-1)),(1/N)); + double alpha=-((Gamma-1/Gamma)/2)*sin(xk1); + double Beta=((Gamma+1/Gamma)/2)*cos(xk1); + double normal=alpha*alpha+Beta*Beta; + poles[j-1]=DoubleComplex((omegar*alpha)/normal,(omegar*Beta)/normal); + tp2=DoubleComplex((omegar*alpha)/normal,(omegar*Beta)/normal); + accumulate2=zmuls(accumulate2,tp2); + } + double qt; + double ra2=zreals(accumulate2); + double ra1=zreals(accumulate1); + qt=dldivs(ra1,ra2); + gain=dabss(qt); + + return gain; + +} + diff --git a/2.3-1/src/c/signalProcessing/zpch2/int_zpch2.h b/2.3-1/src/c/signalProcessing/zpch2/int_zpch2.h new file mode 100644 index 00000000..683a7614 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch2/int_zpch2.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ZPCH2_H__ +#define __INT_ZPCH2_H__ + +#define d0d0d0zpch2z2z2(N,A,omegar,zeros,poles) dzpch2s(N,A,omegar,zeros,poles) + +#endif /* !INT_ZPCH2_H__! */ diff --git a/2.3-1/src/c/signalProcessing/zpch2/zpch2.h b/2.3-1/src/c/signalProcessing/zpch2/zpch2.h new file mode 100644 index 00000000..0d191d5c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch2/zpch2.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ZPCH2_H__ +#define __ZPCH2_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH2_H__ */ |