# Hi everyone, I want to find the polynomials from root. I want to get a value without decimal, how is that possible? Please find the example below for more clarification.

1 ビュー (過去 30 日間)
Supermankid 2017 年 9 月 9 日
コメント済み: Supermankid 2017 年 9 月 11 日
Hi everyone,
I want to find the polynomials from root. I want to get a value without decimal, how is that possible? Please find the example below for more clarification.
>> poly([ -0.1667 + 1.2802i -0.1667 - 1.2802i])
ans =
1.0000 0.3334 1.6667
Which could be x^2+0.3334x+1.66667=0
But how do I obtain values without decimal? 3x^2+x+5=0 is same as x^2+0.3334x+1.66667=0
my question is how do i convert
ans =
1.0000 0.3334 1.6667
TO ===>
ans =
3 1 5

サインインしてコメントする。

### 採用された回答

Stephen23 2017 年 9 月 9 日

>> V = poly([ -0.1667 + 1.2802i -0.1667 - 1.2802i])
V =
1 0.3334 1.6667
>> [N,D] = rat(V,0.001) % get numerator and denominator
N =
1 1 5
D =
1 3 3
>> N = prod(D).*N./D % convert all to same denominator
N =
9 3 15
>> d=N(1); for k=N(2:end), d=gcd(d,k); end % find GCD
>> N = N./d % divide by GCD
N =
3 1 5
##### 3 件のコメント表示 2 件の古いコメント非表示 2 件の古いコメント
Supermankid 2017 年 9 月 11 日
Hi Stephen,
Thank you for your effort in explaining it making it very simple and clear. You build clever thought to compute this algorithm. Thanks millions.

サインインしてコメントする。

### カテゴリ

Find more on Polynomials in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by