difference between using interp1( X,Y, xi, 'linear', 'extrap') and doing the extrapollation after curve fitting

21 ビュー (過去 30 日間)
Hi
I know extrapollation are not ideal but I used xi= interp1( X,Y, xi, 'linear', 'extrap') and the results are totally onligical so I used fitobject = fit(X,Y, poly1' ); Use I had the equation of the line I can perform my extrapollation and found different values ? X and Y are 300 scattered measurement points, length(X)=length(Y)but of it happens that the same X give slightly different results for Y are there any special conditions to use interp1
I would expect both methods to give the same results?
thanks for any suggestions, regards,J

採用された回答

José-Luis
José-Luis 2012 年 8 月 18 日
編集済み: José-Luis 2012 年 8 月 18 日
The methods are different and will not give the same results. The curve fit will fit a line (one and only one) to all your points (linear least squares if you don't specify anything else) and the extrapolation will be points on that line.
Interp1 will draw a line (provided you use the default option) between succesive points and use that for extrapolation. Therefore you end up with many segments and not a single line.
Cheers!
  2 件のコメント
Jürgen
Jürgen 2012 年 8 月 18 日
thanks for the clear explanation super
so when you do an extrapolation it is only based on the line trought the last two points?
José-Luis
José-Luis 2012 年 8 月 18 日
編集済み: José-Luis 2012 年 8 月 18 日
Yes, for a linear fit.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by