From: Jorian on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hdes1g$l0s$1(a)fred.mathworks.com>...
> "Oleg Komarov" <oleg.komarov(a)hotmail.it> wrote in message <hdepgr$e3d$1(a)fred.mathworks.com>...
> > "Steven Lord" <slord(a)mathworks.com> wrote in message <hdek22$qbk$1(a)fred.mathworks.com>...
> > >
> > > "Oleg Komarov" <oleg.komarov(a)hotmail.it> wrote in message
> > > news:hdeh76$q3s$1(a)fred.mathworks.com...
> > > > To Bruno:
> > > > correct me if i'm wrong, your function uses nchoosek, which means the same
> > > > as going to new york and flying back to london starting from rome.
> > > > i was looking for somthing that, under ex-ante constraints, goes right to
> > > > london. :)
> > >
> > > To get from the upper-left to lower-right corner of an m-by-n grid, you need
> > > to take m-1 steps down and n-1 steps right. It doesn't really matter in
> > > which order you take these steps. So the number of paths is (m+n-2) choose
> > > (m-1) [the total number of steps is (m+n-2), and we choose at which steps we
> > > want to move down] or (m+n-2) choose (n-1) [choosing when we move right].
> > > Thus Bruno's code is correct to use NCHOOSEK to compute the number of
> > > possible paths.
> > >
> > > http://mathforum.org/library/drmath/view/66728.html
> > >
> > > --
> > > Steve Lord
> > > slord(a)mathworks.com
> > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > >
> > Thanks for the enlightment!
> > To Bruno: i was confused your function provided me with a stright ticket to london! :)
>
> If you want to get the number of possible fly to London (and only that), just type
>
> npath = allVL1(ny,nx-1,[],NaN)
>
> It's correct that there is a relation with NCHOOSEK as Steve pointed out.
>
> Bruno
I agree with you completely. Thank you! I need this too

Best regards, Jorian Seokaner!

http://www.mathworks.com/matlabcentral/newsreader/author/126323
 | 
Pages: 1
Prev: forloop efficiency
Next: cognitive radio