Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Compute a bivariate probability mass function on a predefined grid without loops
Date: Sat, 21 Apr 2012 14:51:24 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <jmuhhc$97p$1@newscl01ah.mathworks.com>
References: <jms4dg$7db$1@newscl01ah.mathworks.com> <jmtam1$e0q$1@newscl01ah.mathworks.com> <jmu49f$j4h$1@newscl01ah.mathworks.com> <jmu8rb$6fh$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1335019884 9465 172.30.248.38 (21 Apr 2012 14:51:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 21 Apr 2012 14:51:24 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:765415

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <jmu8rb$6fh$1@newscl01ah.mathworks.com>...
> p = interp1(k,1:length(k),Sk);
> q = interp1(m,1:length(m),Sm);
- - - - - - - - - -
  Hi Bruno.  Why is it necessary to call on 'interp1'?  Can't we just say:

 p = (Sk-k(1))*((N-1)/(k(N)-k(1)))+1;
 q = (Sm-m(1))*((N-1)/(m(N)-m(1)))+1;

which takes advantage of the assumption of uniform spacing in k and m.

Roger Stafford