How to extend line of best fit to find x intercept ?

31 ビュー (過去 30 日間)
Yash Mantri
Yash Mantri 2020 年 7 月 1 日
編集済み: Matt J 2020 年 7 月 1 日
This is my plot, and I simply wish to find where the line of best fit meets with the x axis.
x=[0.200 0.100 0.067 0.050 0.040 0.033 0.025];
y=[0.214 0.158 0.130 0.125 0.136 0.115 0.107];
axis([0 0.025 0 0.025]);
plot(x,y,'x');
hold on
title('lineweaver-burk plot');
xlabel('1/S');
ylabel('1/Vo ');
figure(2)
scatter(x,y);
%Plotting the line of best fit
p=polyfit(x,y,1);
x1=linspace(min(x), max(x), 100);
y1=polyval(p,x1);
plot(x1,y1,'r-', 'LineWidth',3);
hold off
Any help would be appreciated! (I'm a beginner!)

採用された回答

Matt J
Matt J 2020 年 7 月 1 日
roots(p)
  2 件のコメント
Yash Mantri
Yash Mantri 2020 年 7 月 1 日
Oh thanks! That works :)
Quick follow-up question :What if I have to find the Y intercept in such a case?
Matt J
Matt J 2020 年 7 月 1 日
編集済み: Matt J 2020 年 7 月 1 日
Oh thanks! That works :)
You're welcome. Please Accept-click the answer to signify that it addressed your question.
Quick follow-up question :What if I have to find the Y intercept in such a case?
That would be
polyval(p,0)
or
p(2)

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by