diff options
author | Abhinav Dronamraju | 2017-11-27 15:25:37 +0530 |
---|---|---|
committer | Abhinav Dronamraju | 2017-11-27 15:25:37 +0530 |
commit | b7969c62478edc84055e71df9fed140402406396 (patch) | |
tree | 048b7c76423fe27dee2e31a52bae93c95883614e /macros/mscohere.sci | |
parent | 2bb28947f9736c1c65dd338bf1bc8fcc2570b22d (diff) | |
parent | d972a68bc5b3c4c059b70e4f8cd64a64538c2be8 (diff) | |
download | FOSSEE-Signal-Processing-Toolbox-b7969c62478edc84055e71df9fed140402406396.tar.gz FOSSEE-Signal-Processing-Toolbox-b7969c62478edc84055e71df9fed140402406396.tar.bz2 FOSSEE-Signal-Processing-Toolbox-b7969c62478edc84055e71df9fed140402406396.zip |
Merge with upstream
Diffstat (limited to 'macros/mscohere.sci')
-rw-r--r-- | macros/mscohere.sci | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/macros/mscohere.sci b/macros/mscohere.sci new file mode 100644 index 0000000..357da58 --- /dev/null +++ b/macros/mscohere.sci @@ -0,0 +1,82 @@ +function [PXX, FREQ] = mscohere (X, Y, WINDOW, OVERLAP, NFFT, FS, RANGE) +//It estimate (mean square) coherence of signals x and y. +//Calling Sequence +//[Pxx, freq] = mscohere (x, y) +//[Pxx, freq] = mscohere (x, y, window) +//[Pxx, freq] = mscohere (x, y, window, overlap) +//[Pxx, freq] = mscohere (x, y, window, overlap, Nfft) +//[Pxx, freq] = mscohere (x, y, window, overlap, Nfft, Fs) +//[Pxx, freq] = mscohere (x, y, window, overlap, Nfft, Fs, range) +//mscohere (...) +//Description +//This function estimate (mean square) coherence of signals x and y. +//Examples +//[Pxx, freq] = mscohere(4,5) +//ans = +//PXX = +// Nan +// 1 +//FREQ = +// 0 +// 0.5 +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 2 | rhs > 7) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 2 then + if(lhs==0) + callOctave("mscohere",X,Y) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y) + else + error("Wrong number of output arguments.") + end + + case 3 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW) + else + error("Wrong number of output arguments.") + end + case 4 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP) + else + error("Wrong number of output arguments.") + end + case 5 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT) + else + error("Wrong number of output arguments.") + end + case 6 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS) + else + error("Wrong number of output arguments.") + end + case 7 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS,RANGE,) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS,RANGE) + else + error("Wrong number of output arguments.") + end + end +endfunction + |