diff options
author | avinashlalotra | 2025-04-04 00:59:57 +0530 |
---|---|---|
committer | avinashlalotra | 2025-04-04 00:59:57 +0530 |
commit | 83e5ba3290945430d98d75b59e20f896f134237f (patch) | |
tree | 7df4d17f0337bd73e4c0d511fdfd05118f6c3766 /macros | |
parent | e0ace969c08d89b41d0b15ae8a8fc479379d7b14 (diff) | |
download | FOSSEE-Signal-Processing-Toolbox-83e5ba3290945430d98d75b59e20f896f134237f.tar.gz FOSSEE-Signal-Processing-Toolbox-83e5ba3290945430d98d75b59e20f896f134237f.tar.bz2 FOSSEE-Signal-Processing-Toolbox-83e5ba3290945430d98d75b59e20f896f134237f.zip |
fix: isvector was returning true for scalars
Diffstat (limited to 'macros')
-rw-r--r-- | macros/mexihat.sci | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/macros/mexihat.sci b/macros/mexihat.sci index 5f94988..febad61 100644 --- a/macros/mexihat.sci +++ b/macros/mexihat.sci @@ -5,12 +5,10 @@ // 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:[insert name] +// Last Modified by : Abinash Singh , FOSSEE Winter Intern // Organization: FOSSEE, IIT Bombay // Email: toolbox@scilab.in - - function [psi,x]=mexihat(lb,ub,n) // Generates Mexican Hat wavelet @@ -31,26 +29,22 @@ function [psi,x]=mexihat(lb,ub,n) // a = [0;0;0] // b = [1;1;1] -funcprot(0); - -[nargout,nargin]=argn(); - + funcprot(0); + [nargout,nargin]=argn(); + x=[];psi=[]; if (nargin < 3) - error("wrong number of input arguments"); - end - + error("wrong number of input arguments"); + end if (n <= 0) error("n must be strictly positive"); end - - if(isvector(lb)) + if(isscalar(lb)) + x = linspace(lb,ub,n); + psi = (1-x.^2).*(2/(sqrt(3)*%pi^0.25)) .* exp(-x.^2/2) ; + else for(i=1:length(lb)) - x(i) = linspace(lb(i),ub,n); - psi(i) = (1-x(i).^2).*(2/(sqrt(3)*%pi^0.25)) .* exp(-x(i).^2/2) ; + x(i) = linspace(lb(i),ub,n); + psi(i) = (1-x(i).^2).*(2/(sqrt(3)*%pi^0.25)) .* exp(-x(i).^2/2) ; + end end - -else - x = linspace(lb,ub,n); - psi = (1-x.^2).*(2/(sqrt(3)*%pi^0.25)) .* exp(-x.^2/2) ; -end endfunction |