Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: pattern matching among two matrix Date: Fri, 25 Nov 2011 19:17:08 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 20 Message-ID: <jaopjk$t2p$1@newscl01ah.mathworks.com> References: <jam3h8$sj1$1@newscl01ah.mathworks.com> <jam7q5$b9b$1@newscl01ah.mathworks.com> <cb60d1d5-1a81-4185-91b1-ef0fefe5efc6@h42g2000yqd.googlegroups.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-01-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1322248628 29785 172.30.248.46 (25 Nov 2011 19:17:08 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 25 Nov 2011 19:17:08 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:750477 ImageAnalyst <imageanalyst@mailinator.com> wrote in message <cb60d1d5-1a81-4185-91b1-ef0fefe5efc6@h42g2000yqd.googlegroups.com>... > ....... > template = bigMatrix(3:5, 7:9) > ....... - - - - - - - - - - You have given the 'template' equality to a portion of 'bigMatrix' in stating that template = bigMatrix(3:5, 7:9) However the counterexample I mentioned shows that you can get a correlation of 1 at that relative location even where you might only have something like template = 10*bigMatrix(3:5, 7:9)-100 holding true there. It is a consequence of the Cauchy–Bunyakovsky–Schwarz inequality theorem that equality of the correlation to 1 or -1 is true if and only if the two matrix portions are linearly dependent. They do not have to be equal. Of course if the notion of pattern matching is satisfied by merely having linearly related patterns, then searching for a correlation of 1 would be a good method of detecting such a condition. It all hinges on the meaning to be ascribed to a "match" of two patterns. Roger Stafford