Path: news.mathworks.com!not-for-mail
From: "Massimo" <giovanma@bc.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Compute a bivariate probability mass function on a predefined grid without loops
Date: Sat, 21 Apr 2012 11:05:19 +0000 (UTC)
Organization: Boston College
Lines: 26
Message-ID: <jmu49f$j4h$1@newscl01ah.mathworks.com>
References: <jms4dg$7db$1@newscl01ah.mathworks.com> <jmtam1$e0q$1@newscl01ah.mathworks.com>
Reply-To: "Massimo" <giovanma@bc.edu>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1335006319 19601 172.30.248.37 (21 Apr 2012 11:05:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 21 Apr 2012 11:05:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1404562
Xref: news.mathworks.com comp.soft-sys.matlab:765401

"Roger Stafford" wrote in message <jmtam1$e0q$1@newscl01ah.mathworks.com>...
> "Massimo" <giovanma@bc.edu> wrote in message <jms4dg$7db$1@newscl01ah.mathworks.com>...

>   Your method of weighting here seems inconsistent with the intention established in your thread 311682 of Aug. 17, 2011.  In that thread when s was equal to a(j) then a(j) received a weight of one and adjacent points weights of zero.  In this thread when Sk = k(l) and Sm = m(r), then the point (k(l),m(r)) receives a weight of zero with the three other rectangle points receiving all the weight.  As you pass over a point the particular three rectangular points receiving all the weights takes a discontinuous jump to a different rectangle.  Why is this?  Your weighting in accordance with relative Euclidean distances seems very strange.
> 
>   I would have thought you would make the following definitions:
> 
>  a = Sk(i,j)-k(l);
>  b = Sm(i,j)-m(r);
>  c = k(l+1)-Sk(i,j);
>  d = m(r+1)-Sm(i,j);
> 
>  f(k(l),m(r)) = (c*d)/((a+c)*(b+d));
>  f(k(l+1),m(r)) = (a*d)/((a+c)*(b+d));
>  f(k(l+1),m(r+1)) = (a*b)/((a+c)*(b+d));
>  f(k(l),m(r+1)) = (b*c)/((a+c)*(b+d));
> 
> This way when {Sk,Sm) coincides with a point of (k,m), that point would receive a weight of one and the surrounding grid points would all have weights of zero from (Sk,Sm).  As you vary (Sk,Sm) the weighting would vary without discontinuous jumps.
> 
> Roger Stafford

Roger,
you are absolutely right!! Thanks for spotting my dumb mistake!!
I don't know honestly how I came up with the idea of redistributing weights according to the euclidean distance...maybe I was just very tired:)
What I intended to obtain is exactly what you suggested.
Now the point is to figure out how to do it on Matlab in a smart way..