Thread Subject: Programming Question

Subject: Programming Question

From: Rafael

Date: 21 Jun, 2009 19:54:02

Message: 1 of 5

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.

Subject: Programming Question

From: Rafael

Date: 21 Jun, 2009 20:34:01

Message: 2 of 5

In order to clarify this, I have scanned an example worked out on pen and paper:

http://img526.imageshack.us/img526/5264/mutation.jpg

Thanks again

Subject: Programming Question

From: Sadik

Date: 21 Jun, 2009 20:47:01

Message: 3 of 5

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.

Subject: Programming Question

From: us

Date: 21 Jun, 2009 20:50:02

Message: 4 of 5

"Rafael " <rrodriguez1989@gmail.com> wrote in message <h1m5fp$d49$1@fred.mathworks.com>...
> In order to clarify this, I have scanned an example worked out on pen and paper:
>
> http://img526.imageshack.us/img526/5264/mutation.jpg
>
> Thanks again

thanks for the example...
now, where is your ML code...

us

Subject: Programming Question

From: Rafael

Date: 21 Jun, 2009 20:52:01

Message: 5 of 5

Thank you for your response!

I am trying to figure out how to write a simple program that will take an input of "n" and display a resulting matrix based on the work that I scanned in.

Thanks!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
equation Sprinceana 22 Jun, 2009 08:56:32
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com