フィルターのクリア

Output vector in the polyval

2 ビュー (過去 30 日間)
Aji Bowo
Aji Bowo 2021 年 11 月 17 日
編集済み: John D'Errico 2021 年 11 月 17 日
A quick question. How do I make this so that the value in the array is not factor out. This is my code
p=[1 0 0 0 0 -5 3 21];
x=[10 15 20];
poly_value=polyval(p,x)
poly_value = 1×3
1.0e+09 * 0.0100 0.1709 1.2800
What I mean is how can get rid of that 10^9 and instead i want the output to be what it is in the array

採用された回答

John D'Errico
John D'Errico 2021 年 11 月 17 日
format long g
p=[1 0 0 0 0 -5 3 21];
x=[10 15 20];
poly_value=polyval(p,x)
poly_value =
9999551 170858316 1279998081
  2 件のコメント
Aji Bowo
Aji Bowo 2021 年 11 月 17 日
I have tried tried format long before but didnt get the same like this. What is the use of that g in the end??
John D'Errico
John D'Errico 2021 年 11 月 17 日
編集済み: John D'Errico 2021 年 11 月 17 日
From the help for format...
format LONG Scaled fixed point format with 15 digits for double
and 7 digits for single.
format LONGG Best of fixed or floating point format with 15
digits for double and 7 digits for single.
If the double precision numbers fit into 15 digits, it will try to display them without exponents. At some point, it gives up.
format long g
X = 1.2345678901234*10.^(-20:5:20)'
X =
1.2345678901234e-20
1.2345678901234e-15
1.2345678901234e-10
1.2345678901234e-05
1.2345678901234
123456.78901234
12345678901.234
1.2345678901234e+15
1.2345678901234e+20
But even then, it is not factoring out the exponent.
format long
X = 1.2345678901234*10.^(-20:5:20)'
X =
1.0e+20 *
0.000000000000000
0.000000000000000
0.000000000000000
0.000000000000000
0.000000000000000
0.000000000000001
0.000000000123457
0.000012345678901
1.234567890123400
See that format long does what you do not wish to see happen.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by