```Path: news.mathworks.com!not-for-mail
Newsgroups: comp.soft-sys.matlab
Subject: Re: Programming Question
Date: Sun, 21 Jun 2009 20:47:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <h1m685\$150\$1@fred.mathworks.com>
References: <h1m34q\$fod\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245617221 1184 172.30.248.37 (21 Jun 2009 20:47:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 21 Jun 2009 20:47:01 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:549342

You seem to have figured out. I am writing the equations in case you haven't:

q = 0.4;
n = 2;
d = [0 1 1 2;1 0 2 1;1 2 0 1;2 1 1 0];
M=q^n * ((1-q)/(q))^d;

Best.

"Rafael " <rrodriguez1989@gmail.com> wrote in message <h1m34q\$fod\$1@fred.mathworks.com>...
> Hello, I am having issues with inputing this equation into matlab.
>
> basic equation:
> M=q^n * ((1-q)/(q))^d
>
> q and n are both inputs from the user
>
> d is a hamming distance that is calculated based on a length
>
> the length is the input n (the length is the number of points on the line)
>
> depending on the length, each point can have a 1 or 0 entry
>
> i.e. if n is 2, the length is 2, and each of the two points can have a 1 or 0 entry, therefore there are 4 different arrangements in a length of 2 units
>
> d is the hamming distance between each of these possible arrangements
>
> this may seem confusing, but any help would be greatly appreciated, i can clarify any questions that may be asked.
```