summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorttt2018-12-06 12:52:33 +0530
committerttt2018-12-06 12:52:33 +0530
commit0ee5488b9c99cdd0d631d97cd1de566a8785ffae (patch)
tree2ee8729d0c116a1f6b258a8aad1bab21c21e1448
parent08123d6bb77e44a2078a04ca16a935c39e53cd42 (diff)
downloadFOSSEE-Signal-Processing-Toolbox-0ee5488b9c99cdd0d631d97cd1de566a8785ffae.tar.gz
FOSSEE-Signal-Processing-Toolbox-0ee5488b9c99cdd0d631d97cd1de566a8785ffae.tar.bz2
FOSSEE-Signal-Processing-Toolbox-0ee5488b9c99cdd0d631d97cd1de566a8785ffae.zip
code by jitendra
-rw-r--r--macros/cmorwavf.sci41
1 files changed, 25 insertions, 16 deletions
diff --git a/macros/cmorwavf.sci b/macros/cmorwavf.sci
index 6c20fc5..e95b8d3 100644
--- a/macros/cmorwavf.sci
+++ b/macros/cmorwavf.sci
@@ -1,26 +1,35 @@
function [psi,x]=cmorwavf(lb,ub,n,fb,fc)
-funcprot(0);
// Finds the Complex Morlet Wavelet
// Calling Sequence
-// [psi,x]=cmorwavf(lb,ub,n,fb,fc)
+// [psi,x]=cmorwavf(lb,ub,n,fb,fc)
// Parameters
-// lb: Real or complex valued vector or matrix
-// ub: Real or complex valued vector or matrix
-// n: Real scalar strictly positive integer
-// fb: Real or complex scalar value
-// fc: Real or complex scalar value
+// lb: Real or complex valued vector or matrix
+// ub: Real or complex valued vector or matrix
+// n: Real scalar strictly positive integer
+// fb: Real or complex scalar value
+// fc: Real or complex scalar value
// Description
-// This is an Octave function.
-// This function returns the value of the Complex Morlet Waveform defined by a positive bandwidth parameter FB, a wavelet center frequency FC on an N point regular grid for the interval [LB,UB].
+// This function returns the value of the Complex Morlet Waveform defined by a positive bandwidth parameter FB, a wavelet center frequency FC on an N point regular grid for the interval [LB,UB].
// Examples
-// [a,b]=cmorwavf(1,2,1,3,4)
-// b=2
-// a=[0.0858628 -1.682D-16i]
+// [a,b]=cmorwavf(1,2,1,3,4)
+// b=2
+// a=0.0858628 -1.682D-16i
-rhs=argn(2);
-if(rhs~=5) then
+
+if(argn(2)~=5 & argn(2)~=3) then
error ("Wrong number of input arguments.")
-end
-[psi,x]=callOctave("cmorwavf",lb,ub,n,fb,fc)
+
+elseif (n<=0 | floor(n) ~=n) then
+
+ error("n must be an integer strictly positive");
+ end
+
+ if (argn(2)==3) then
+ fb=1; fc=1;
+ end
+
+x = linspace(lb,ub,n);
+ psi =((%pi*fb)^(-0.5))*exp(2*%i*%pi*fc.*x).*exp(-x.^2/fb);
+
endfunction