フィルターのクリア

Read the value of the trend line from an X-value

4 ビュー (過去 30 日間)
Max1234
Max1234 2023 年 2 月 26 日
編集済み: Image Analyst 2023 年 2 月 26 日
Hi guys,
I have displayed measurement data as scatter and created the trend lines with polyval and polyfit. Is there a way to read the value of the trend line from an X-value?
Many thanks in advance!

採用された回答

Image Analyst
Image Analyst 2023 年 2 月 26 日
See my attached polyfit demo.
Once you have the formula coefficients, you can either use the equation (like in the title of the plots above), or use the function polyval to get the estimated/fitted y value.
  2 件のコメント
Max1234
Max1234 2023 年 2 月 26 日
Thanks! Where can i find the formula coefficients?
Image Analyst
Image Analyst 2023 年 2 月 26 日
編集済み: Image Analyst 2023 年 2 月 26 日
It's a variable (vector) in the program called "coefficients". Open up the code and look at it. It's exceptionally well commented. Specifically
% Do the regression with polyfit to fit a cubic polynomial.
cubicCefficients = polyfit(x, y, 3)
I also show how to get the equation using those coefficients.
% Get the estimated values with polyval()
yFit = polyval(cubicCefficients, xFit);

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by