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:
diagonally dominant matrix

Subject: diagonally dominant matrix

From: dew dropz

Date: 28 Apr, 2009 16:11:02

Message: 1 of 6

hi, i am new to matlab n i need a code to create a random diagonally dominant matrix

Subject: diagonally dominant matrix

From: John D'Errico

Date: 28 Apr, 2009 16:29:01

Message: 2 of 6

"dew dropz" <dewdropz89@msn.com> wrote in message <gt79qm$ptn$1@fred.mathworks.com>...
> hi, i am new to matlab n i need a code to create a random diagonally dominant matrix

This will do it:

eye(n)

It is random, with however a rather narrow distribution
on the elements. Or, perhaps you may consider it as
random, just perhaps rather lucky.

Unfortunately, your problem as posed is impossible
to answer, at least without any knowledge of the
desired distribution of the elements.

John

Subject: diagonally dominant matrix

From: Roger Stafford

Date: 28 Apr, 2009 16:32:03

Message: 3 of 6

"dew dropz" <dewdropz89@msn.com> wrote in message <gt79qm$ptn$1@fred.mathworks.com>...
> hi, i am new to matlab n i need a code to create a random diagonally dominant matrix

  I suggest you read carefully the definition of a diagonally dominant matrix in for example:

 http://en.wikipedia.org/wiki/Diagonally_dominant_matrix

and proceed from there. You should be able to make use of 'rand' or 'randn' to build up some kind of random matrix that adheres to these rules. Create the non-diagonals first and use their values to determine what constraints are to be placed on the random diagonal terms.

Roger Stafford

Subject: diagonally dominant matrix

From: dew dropz

Date: 30 Apr, 2009 11:45:45

Message: 4 of 6

"dew dropz" <dewdropz89@msn.com> wrote in message <gt79qm$ptn$1@fred.mathworks.com>...
> hi, i am new to matlab n i need a code to create a random diagonally dominant matrix
thx, buy the eye(n) is just an identity matrix, and rand gives decimals.
 i meant a random matrix with integers but has to be diagonally dominant

Subject: diagonally dominant matrix

From: Stefan

Date: 30 Apr, 2009 13:45:03

Message: 5 of 6


Does this serve?

z=round(1000*randn(5,5))
z2=z+diag(sum(abs(z),2))

, but I guess you would have learnt more by doing it yourself.

Regards,
Stefan

"dew dropz" <dewdropz89@msn.com> wrote in message <gtc319$m35$1@fred.mathworks.com>...
> "dew dropz" <dewdropz89@msn.com> wrote in message <gt79qm$ptn$1@fred.mathworks.com>...
> > hi, i am new to matlab n i need a code to create a random diagonally dominant matrix
> thx, buy the eye(n) is just an identity matrix, and rand gives decimals.
> i meant a random matrix with integers but has to be diagonally dominant

Subject: diagonally dominant matrix

From: jessica david

Date: 3 May, 2009 21:21:02

Message: 6 of 6

yes thanks


"Stefan" <nospam@yahoo.com> wrote in message <gtca0v$7nb$1@fred.mathworks.com>...
>
> Does this serve?
>
> z=round(1000*randn(5,5))
> z2=z+diag(sum(abs(z),2))
>
> , but I guess you would have learnt more by doing it yourself.
>
> Regards,
> Stefan
>
> "dew dropz" <dewdropz89@msn.com> wrote in message <gtc319$m35$1@fred.mathworks.com>...
> > "dew dropz" <dewdropz89@msn.com> wrote in message <gt79qm$ptn$1@fred.mathworks.com>...
> > > hi, i am new to matlab n i need a code to create a random diagonally dominant matrix
> > thx, buy the eye(n) is just an identity matrix, and rand gives decimals.
> > i meant a random matrix with integers but has to be diagonally dominant

Tags for this Thread

No tags are associated with 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