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:
Root functions?

Subject: Root functions?

From: Chris McCorquodale

Date: 22 Dec, 2010 12:31:04

Message: 1 of 6

Hi,

I was wondering if anyone can tell me how to implement a "root" function in matlab. I know that the square root is simply sqrt(....) but what about fourth or fifth, negative roots etc?

I am quite new to matlab so help here would be much appreciated,

Chris

Subject: Root functions?

From: Grzegorz Knor

Date: 22 Dec, 2010 12:48:05

Message: 2 of 6

"Chris McCorquodale" wrote in message <iesr28$o1a$1@fred.mathworks.com>...
> Hi,
>
> I was wondering if anyone can tell me how to implement a "root" function in matlab. I know that the square root is simply sqrt(....) but what about fourth or fifth, negative roots etc?
>
> I am quite new to matlab so help here would be much appreciated,
>
> Chris

^ - Matrix power. X^p is X to the power p, if p is a scalar. If p is an integer, the power is computed by repeated squaring. If the integer is negative, X is inverted first. For other values of p, the calculation involves eigenvalues and eigenvectors, such that if [V,D] = eig(X), then X^p = V*D.^p/V.

http://www.mathworks.com/help/techdoc/ref/arithmeticoperators.html

Grzegorz

Subject: Root functions?

From: Bruno Luong

Date: 22 Dec, 2010 13:31:22

Message: 3 of 6

"Chris McCorquodale" wrote in message <iesr28$o1a$1@fred.mathworks.com>...
> Hi,
>
> I was wondering if anyone can tell me how to implement a "root" function in matlab. I know that the square root is simply sqrt(....) but what about fourth or fifth, negative roots etc?
>
> I am quite new to matlab so help here would be much appreciated,
>
> Chris

fifth "root" of x:
x.^(1/5)

Bruno

Subject: Root functions?

From: Chris McCorquodale

Date: 22 Dec, 2010 14:05:08

Message: 4 of 6

Thank you both very much for your answer!

Chris

Subject: Root functions?

From: Chris McCorquodale

Date: 22 Dec, 2010 14:07:05

Message: 5 of 6

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <iesuj9$dm4$1@fred.mathworks.com>...
> "Chris McCorquodale" wrote in message <iesr28$o1a$1@fred.mathworks.com>...
> > Hi,
> >
> > I was wondering if anyone can tell me how to implement a "root" function in matlab. I know that the square root is simply sqrt(....) but what about fourth or fifth, negative roots etc?
> >
> > I am quite new to matlab so help here would be much appreciated,
> >
> > Chris
>
> fifth "root" of x:
> x.^(1/5)
>
> Bruno

Thanks you both very much for your answer!

Chris

Subject: Root functions?

From: Matt J

Date: 22 Dec, 2010 14:35:24

Message: 6 of 6

"Chris McCorquodale" wrote in message <iesr28$o1a$1@fred.mathworks.com>...
> Hi,
>
> I was wondering if anyone can tell me how to implement a "root" function in matlab. I know that the square root is simply sqrt(....) but what about fourth or fifth, negative roots etc?
=======

There's also the NTHROOT function, if you are interested in only real roots.

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