how to do a TRENDLINE (polyfit?how?)
1 回表示 (過去 30 日間)
古いコメントを表示
how can i do a trenline like this in matlab
here is the data
thank you very much
0 件のコメント
採用された回答
Matt Fig
2012 年 11 月 28 日
編集済み: Matt Fig
2012 年 11 月 28 日
I see you edited the question to include (polyfit?how?) but what is the problem? Did you actually read the help for POLYFIT (that I even linked for you!) or do you want everyone else to do all the work for you?
If you have difficulty, why not show where you are stuck?
2 件のコメント
Matt Fig
2012 年 11 月 29 日
I downloaded your file and got the exact same results as Excel with MATLAB. I called the data N.
>> X = N(22:end,1);
>> Y = N(22:end,2);
>> [pp,s] = polyfit(X,Y,1)
pp =
-0.0406 0.8654
s =
R: [2x2 double]
df: 76
normr: 0.2742
>> r_squared = 1 - s.normr^2 / norm(Y-mean(Y))^2
r_squared =
0.9719
その他の回答 (1 件)
Image Analyst
2012 年 11 月 28 日
3 件のコメント
Image Analyst
2012 年 11 月 28 日
Not sure what you looked at but I saw all kinds of curvy and wavy functions being fitted to data.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!