From: "Massimo" <>
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$>
References: <jms4dg$7db$> <jmtam1$e0q$>
Reply-To: "Massimo" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1335006319 19601 (21 Apr 2012 11:05:19 GMT)
NNTP-Posting-Date: Sat, 21 Apr 2012 11:05:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1404562
Xref: comp.soft-sys.matlab:765401

"Roger Stafford" wrote in message <jmtam1$e0q$>...
> "Massimo" <> wrote in message <jms4dg$7db$>...

>   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

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..