File: corr.dia.ref

package info (click to toggle)
scilab 6.0.1-10%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 365,292 kB
  • sloc: xml: 827,376; cpp: 273,125; ansic: 216,672; java: 190,706; fortran: 90,783; ml: 24,107; tcl: 16,853; sh: 13,608; makefile: 9,556; lex: 1,615; perl: 1,566; yacc: 1,263; php: 690; cs: 614
file content (33 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//<-- CLI SHELL MODE -->
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - DIGITEO
// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
rand('normal');
x=rand(1,256);
y=-x;
deff('[z]=xx(inc,is)','z=x(is:is+inc-1)');
deff('[z]=yy(inc,is)','z=y(is:is+inc-1)');
[c, mxy]=corr(x,y,32);
if or(size(c)<>[1 32]) then bugmes();quit;end
if or(size(mxy)<>[1 2]) then bugmes();quit;end
x=x-mxy(1)*ones(x);
y=y-mxy(2)*ones(y);
c1=corr(x,y,32);
c2=corr(x,32);
assert_checkalmostequal(c1, -c2, [], 10*%eps);
[c3,m3]=corr('fft',xx,yy,256,32);
assert_checkalmostequal(c1, c3, [], 10*%eps);
[c4,m4]=corr('fft',xx,256,32);
assert_checkalmostequal(c1, -c2, [], 10*%eps)
 ans  =
  T
assert_checkequal(size(c4), [1 32]);
assert_checkequal(size(m4), [1 1]);
assert_checkalmostequal(norm(m3, 1), %eps, [], %eps);
assert_checkalmostequal(norm(m4,1), %eps, [], %eps);
assert_checkalmostequal(c3, c1, [], 10*%eps);
assert_checkalmostequal(c4, c2, [], 10*%eps);