Show older comments
以下にて近似を行い、解を求めます。
x = [3.51E+07 2.94E+07 2.49E+07 2.14E+07 1.85E+07 1.63E+07 1.45E+07 1.31E+07 1.19E+07];
y = [1.69E-01 1.61E-01 1.53E-01 1.43E-01 1.33E-01 1.22E-01 1.10E-01 9.81E-02 8.64E-02];
p = polyfit(x,y,2)
r = roots(p)
plot(x,y,'o')
ところが「データのセンタリングとスケーリングを試してください。」とのエラーが出ます。ただ、結果は出力されます。
xの値から指数を以下のように除くとエラーは出ません。
x = [3.51 2.94 2.49 2.14 1.85 1.63 1.45 1.31 1.19];
最初のデータでOctaveで行いますと、エラーは出ません。matlabとoctaveの結果は一致します。
多項式の曲線近似のエラーは無視してよいものでしょうか?
2 Comments
Akira Agata
on 13 Jan 2021
polyfit の出力として第3引数を指定すると自動的にデータのセンタリングとスケーリングを実施しますので、このエラーが回避できるかと思います。polyfit 関数のヘルプページや、下記Answerが参考になるかと思います。
fumio hakamada
on 13 Jan 2021
Answers (0)
Categories
Find more on 多項式 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!