Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

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

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.

Contact us