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:
Solve Ax = b for nxn Hilbert Matrix

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Ashley Daly

Date: 21 Jan, 2009 16:01:20

Message: 1 of 8

Hi. I've never used MATLAB before, but I have to write a program that solves Ax = b where A is the nxn Hilbert matrix and b is the nx1 vector of all ones. I have no idea how to generate this in MATLAB. Can anyone help or give me some helpful hints? Thanks.

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Matt

Date: 21 Jan, 2009 16:29:02

Message: 2 of 8

"Ashley Daly" <kl0vis3000@hotmail.com> wrote in message <gl7gsg$oj3$1@fred.mathworks.com>...
> Hi. I've never used MATLAB before, but I have to write a program that solves Ax = b where A is the nxn Hilbert matrix and b is the nx1 vector of all ones. I have no idea how to generate this in MATLAB. Can anyone help or give me some helpful hints? Thanks.

For useful help documentation type

>>help ndgrid

and

>>help slash

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Roger Stafford

Date: 21 Jan, 2009 16:35:18

Message: 3 of 8

"Ashley Daly" <kl0vis3000@hotmail.com> wrote in message <gl7gsg$oj3$1@fred.mathworks.com>...
> Hi. I've never used MATLAB before, but I have to write a program that solves Ax = b where A is the nxn Hilbert matrix and b is the nx1 vector of all ones. I have no idea how to generate this in MATLAB. Can anyone help or give me some helpful hints? Thanks.

 x = hilbert(n)\ones(n,1);

works fine for me. Did you have trouble with it?

Roger Stafford

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Matt

Date: 21 Jan, 2009 16:48:01

Message: 4 of 8

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gl7is6$gte$1@fred.mathworks.com>...
> "Ashley Daly" <kl0vis3000@hotmail.com> wrote in message <gl7gsg$oj3$1@fred.mathworks.com>...
> > Hi. I've never used MATLAB before, but I have to write a program that solves Ax = b where A is the nxn Hilbert matrix and b is the nx1 vector of all ones. I have no idea how to generate this in MATLAB. Can anyone help or give me some helpful hints? Thanks.
>
> x = hilbert(n)\ones(n,1);
>
> works fine for me. Did you have trouble with it?
>
> Roger Stafford

This seems to require a toolbox. My MATLAB installation doesn't recognize hilbert()

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Titus

Date: 21 Jan, 2009 17:06:52

Message: 5 of 8


"Matt " <mjacobson.removethis@xorantech.com> schrieb im Newsbeitrag
news:gl7jk1$9rk$1@fred.mathworks.com...
> "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in
> message <gl7is6$gte$1@fred.mathworks.com>...
>> "Ashley Daly" <kl0vis3000@hotmail.com> wrote in message
>> <gl7gsg$oj3$1@fred.mathworks.com>...
>> > Hi. I've never used MATLAB before, but I have to write a program that
>> > solves Ax = b where A is the nxn Hilbert matrix and b is the nx1 vector
>> > of all ones. I have no idea how to generate this in MATLAB. Can anyone
>> > help or give me some helpful hints? Thanks.
>>
>> x = hilbert(n)\ones(n,1);
>>
>> works fine for me. Did you have trouble with it?
>>
>> Roger Stafford
>
> This seems to require a toolbox. My MATLAB installation doesn't recognize
> hilbert()
>
>

Hi Matt,

no, was a typo. Should have read
x = hilb(n)\ones(n,1);

Titus

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Roger Stafford

Date: 21 Jan, 2009 19:11:01

Message: 6 of 8

"Matt " <mjacobson.removethis@xorantech.com> wrote in message <gl7jk1$9rk$1@fred.mathworks.com>...
> ......
> This seems to require a toolbox. My MATLAB installation doesn't recognize hilbert()

  My apologies. By mistake I called on another m-file named 'hilbert.m' which also creates very singular matrices. However, as Titus indicates, it also works with

 x = hilb(n)\ones(n,1);

Roger Stafford

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Ashley Daly

Date: 21 Jan, 2009 22:18:02

Message: 7 of 8

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gl7s05$pkh$1@fred.mathworks.com>...
> "Matt " <mjacobson.removethis@xorantech.com> wrote in message <gl7jk1$9rk$1@fred.mathworks.com>...
> > ......
> > This seems to require a toolbox. My MATLAB installation doesn't recognize hilbert()
>
> My apologies. By mistake I called on another m-file named 'hilbert.m' which also creates very singular matrices. However, as Titus indicates, it also works with
>
> x = hilb(n)\ones(n,1);
>
> Roger Stafford

I think I figured out a way to do it. Like I said, I'm extremely new to using MATLAB, so I'm not sure how things work. If you just typed in x = hilb(n)\ones(n,1); it won't be able to give you anything, correct? Do you first have to have a line that says n = a number, where you can change the number so as to alter the rest of the things you need to find out?

Subject: Solve Ax = b for nxn Hilbert Matrix

From: Roger Stafford

Date: 21 Jan, 2009 22:39:02

Message: 8 of 8

"Ashley Daly" <kl0vis3000@hotmail.com> wrote in message <gl86uq$kd5$1@fred.mathworks.com>...
>
> I think I figured out a way to do it. Like I said, I'm extremely new to using MATLAB, so I'm not sure how things work. If you just typed in x = hilb(n)\ones(n,1); it won't be able to give you anything, correct? Do you first have to have a line that says n = a number, where you can change the number so as to alter the rest of the things you need to find out?

 That is correct.

Roger Stafford

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