summaryrefslogtreecommitdiff
path: root/macros/gauspuls.sci
diff options
context:
space:
mode:
authorttt2018-12-06 13:02:48 +0530
committerttt2018-12-06 13:02:48 +0530
commit3ffa5ac619587eadfdb4ffd3e2fee57fee385e21 (patch)
tree8ed1a41fc2814d53d60bc4e091a1458350482662 /macros/gauspuls.sci
parent0ee5488b9c99cdd0d631d97cd1de566a8785ffae (diff)
downloadFOSSEE-Signal-Processing-Toolbox-3ffa5ac619587eadfdb4ffd3e2fee57fee385e21.tar.gz
FOSSEE-Signal-Processing-Toolbox-3ffa5ac619587eadfdb4ffd3e2fee57fee385e21.tar.bz2
FOSSEE-Signal-Processing-Toolbox-3ffa5ac619587eadfdb4ffd3e2fee57fee385e21.zip
code by jitendra
Diffstat (limited to 'macros/gauspuls.sci')
-rw-r--r--macros/gauspuls.sci29
1 files changed, 17 insertions, 12 deletions
diff --git a/macros/gauspuls.sci b/macros/gauspuls.sci
index ad853ee..621670b 100644
--- a/macros/gauspuls.sci
+++ b/macros/gauspuls.sci
@@ -1,5 +1,4 @@
function [y]=gauspuls(t,fc,bw)
-
// Generates Gaussian-modulated sinusoidal pulses
// Calling Sequence
// [y]=gauspuls(t,fc,bw)
@@ -10,7 +9,6 @@ function [y]=gauspuls(t,fc,bw)
// fc: Real non negative number or complex number
// bw: Real positive number or complex number
// Description
-// This is an Octave function
// This function returns a Gaussian RF pulse of unity amplitude at the times indicated in array t.
// Examples
// 1. gauspuls(1,2,3)
@@ -18,14 +16,21 @@ function [y]=gauspuls(t,fc,bw)
// 2. gauspuls([1 2 3],1,1)
// ans= 0.0281016 0.0000006 1.093D-14
-funcprot(0);
-rhs=argn(2);
-if ( rhs<1 ) then
- error ("Wrong number of input arguments.")
-elseif (rhs==1)
- y= callOctave("gauspuls",t)
-elseif (rhs==2)
- y= callOctave("gauspuls",t,fc)
-else y= callOctave("gauspuls",t,fc,bw)
-end
+if ( argn(2)<1 | argn(2)>3 ) then
+ error ("Wrong number of input arguments.")
+elseif (argn(2)==1)
+ fc = 1e3; bw = 0.5;
+elseif (argn(2)==2)
+ bw = 0.5;
+ end
+
+
+ if (~isscalar(fc) | ~isreal(fc) | fc<0) then
+ error('fc must be non-negative real scalar')
+ end
+ if (~isscalar(bw) | ~isreal(bw) | bw<=0) then
+ error('bw must be positive real scalar')
+ end
+ y = exp (-t .* t / (2*(1 / (4*%pi^2 * (-(bw^2 * fc^2) / (8 * log (10 ^ (-6/20)))))))) .* cos (2*%pi*fc * t);
+
endfunction