MATLAB Answers

## how to find out the correct coefficients from a roots -vector

Asked by anonym

### anonym (view profile)

on 16 Nov 2012
Latest activity Answered by Ahsan Zamee

### Ahsan Zamee (view profile)

on 18 Feb 2015

Hi everbody Sry for my English ;)

I have a Problem mit those Matlab Functions : poly and roots for example, i have vector a with the polynomial coefficents

a =

`     2     4     6     8`

The roots of these Polynom is roots(a) =

```              -1.6506
-0.1747 + 1.5469i
-0.1747 - 1.5469i```

The poly matlab function can be used to find out the coefficients from roots

but when i use ist on my roots(a), i didnt become my vector a again.

ans =

`    1.0000    2.0000    3.0000    4.0000`

Is there another Methode to find out the correct coefficents from roots ?

Many thanks

Jan Simon

### Jan Simon (view profile)

on 16 Nov 2012

Please post the code you use. The text description "poly can be used to find out the coefficients" does not allow to estimate, if you made a mistake when calling poly().

Currently I find in your question:

```a = [2, 4, 6, 8];
roots(a)
>> -1.6506
-0.1747 + 1.5469i
-0.1747 - 1.5469i
% Now poly() is mentioned
roots(a)
>> ans =
1.0000    2.0000    3.0000    4.0000
```

I do not see, what's going on.

Log in to comment.

## 2 Answers

### Loginatorist (view profile)

Answer by Loginatorist

### Loginatorist (view profile)

on 16 Nov 2012

anonym, you need to think about what you are doing. When you have:

```a = [2 4 6 8];
```

this represents this polynomial:

2*x^3 + 4*x^2 + 6*x + 8 = 0

Now what happens if you divide both sides by 2?? MATLAB simply returns this reduced form:

```poly(roots(a))
```
```ans =
```
`      1.0000    2.0000    3.0000    4.0000`

#### 0 Comments

Log in to comment.

### Ahsan Zamee (view profile)

Answer by Ahsan Zamee

### Ahsan Zamee (view profile)

on 18 Feb 2015

poly is not used to find the roots rather it is used to build polynomials.

#### 0 Comments

Log in to comment.

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

### MATLAB Academy

New to MATLAB?

Learn MATLAB today!