How do I produce an R value for the following data?

4 ビュー (過去 30 日間)
Rhianne Tallarico
Rhianne Tallarico 2018 年 4 月 2 日
回答済み: Von Duesenberg 2018 年 4 月 3 日
time_2 = [0.2572 1.3918 2.9652 4.2965 6.1876 7.8971];
conc_2 = [0.2134 0.1638 0.1241 0.0720 0.0149 -0.0447];
figure
plot(time_2,conc_2)
title('Data Set 2')
xlabel('Time')
ylabel('Concentration')
coeffs = polyfit(time_2,conc_2,1);
fittedX = linspace(min(time_2), max(time_2), 200);
fittedY = polyval(coeffs, fittedX);
hold on;
plot(fittedX, fittedY, 'r-');

回答 (1 件)

Von Duesenberg
Von Duesenberg 2018 年 4 月 3 日
In your case, with a polynomial of degree 1, you are pretty much assessing to whant extent the relationship between your two variables follow a straight line; maybe a simple correlation coefficient is what you want:
corrcoef(time_2, conc_2)

カテゴリ

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