フィルターのクリア

fit a first,second,and third degree polynomial, and determine the respective regression co-efficients.

5 ビュー (過去 30 日間)
i am new to matlab and just need an example to follow, please help Please see attached. thanx
i attempted the first part, plz help with regression...
Time = [1,2,3,4,5,6,7,8,9,10];
Pressure = [26.1,27.0,28.2,29.0,29.8,30.6,31.1,31.3,31.0,30.05];
New_Time = 0:0.5:10;
newf1 = polyval(polyfit(Time,Pressure,1),New_Time);
newf2 = polyval(polyfit(Time,Pressure,2),New_Time);
newf3 = polyval(polyfit(Time,Pressure,3),New_Time);
plot(Time,Pressure,'o',New_Time,newf1,New_Time,newf2,New_Time,newf3)
title('Fit of Pressure Samples')
xlabel('Sample Interval,sec')
ylabel('Pressure, PSI')
legend('Data','Linear Fit','Quadratic Fit','Cubic Fit') % linear is first order, quadratic is second order and cubic is third order
  2 件のコメント
John D'Errico
John D'Errico 2017 年 12 月 5 日
READ THE GETTING STARTED TUTORIALS. Being new is irrelevant. You won't learn a thing until you start making an effort.
james bond
james bond 2017 年 12 月 5 日
編集済み: james bond 2017 年 12 月 5 日
i was working on it i think i got the first part ,i have no idea what to do for the regression....HELP !

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

採用された回答

KSSV
KSSV 2017 年 12 月 5 日
R3 = polyfit(Time,Pressure,3) ;
Gives the coefficients of the polynomial. In this case coefficients of third degree polynomial.
  6 件のコメント
John D'Errico
John D'Errico 2017 年 12 月 5 日
Calling R^2 a "regression coefficient" is spectacularly poor terminology on the part of the person who wrote that assignment. But, yes, if you need to compute R^2, then you need to use the formula.
james bond
james bond 2017 年 12 月 5 日
wow, how do i do that with that formula in matlab ?

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by