How to use polyfit to get the difference out of two functions?
9 ビュー (過去 30 日間)
Stelios Fanourakis 2019 年 4 月 20 日
I have two datasets (X,Y). For every value of Y that corresponds to a value of X.
I am thinking of applying a polyfit command to get the best curve fitting for the data, and as a result I will come up with a function (slope+intercept).
How do I find the difference between those two functions? What command do I apply to subtract Function A from Function B?
その他の回答 (2 件)
John D'Errico 2019 年 4 月 21 日
Polynomials are linear in the coefficients. So the difference of two polynomials is obtained by just subtracting the coefficients. If they are different order polynomials, just pad the low order polynomial with zeros as necessary to correspond to the higher order coefficients that are effectively zero.