在excel中,我记得能够根据文档选择称为“力量”的特定趋势线:

“功率趋势线是最适合用于比较以特定速率增加的测量值(例如,以一秒为间隔的赛车加速度)的数据集的曲线。如果您的数据包含零或负值,则无法创建幂趋势线。

如何在Matlab中实现呢?

例如:

a = [15.5156,0.1995;
7.6003,0.2999;
9.4829,0.2592;
12.2185,0.2239;
23.4094,0.1811];

figure;scatter(a(:,1),a(:,2))

最佳答案

Here是一个可行的解决方案:

a = [15.5156,0.1995;
7.6003,0.2999;
9.4829,0.2592;
12.2185,0.2239;
23.4094,0.1811];

x = a(:, 1);
y = a(:, 2);
n = 2; % order of the fitted polynomial trendline
p = polyfit(x, y, n);
m = 1000; % number of trendline points (the larger the smoother)
xx = linspace(min(x), max(x), m);
yy = polyval(p, xx);

figure;
hold on;
scatter(a(:,1), a(:,2));
plot(xx, yy, 'r-');


您可以轻松地将趋势线计算器代码放入单独的函数中。

关于excel - Matlab中的趋势线选项(Excel),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18484381/

10-11 18:02