Uncertainty analysis of a slope

14 次查看(过去 30 天)
Abul Hasib
Abul Hasib 2020-11-14
编辑: Ameer Hamza 2020-11-14
v2=[45.02007409 120.055849 233.631225 389.351824 590.149849 835.499025 1127.549241]';
F=[0.1342 0.329 0.6141 1.008 1.516 2.149 2.892]';
plot(v2,F)
I have this code. I want to do the uncertainty analysis of the slope. The equation came out to be y=0.0025x+0.019. The Linest function in excel can be used to do that but I would like to know if there is any way to do it in MATLAB.
Any ideas? Thanks in advance.

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-11-14
编辑:Ameer Hamza 2020-11-14
Yes, there are several ways to do this in MATLAB. Most efficient is to use mldivide (\)
v2=[45.02007409 120.055849 233.631225 389.351824 590.149849 835.499025 1127.549241]';
F=[0.1342 0.329 0.6141 1.008 1.516 2.149 2.892]';
A = [v2, ones(size(v2))];
x = A\F
Result
>> x
x =
0.0025
0.0193
Another way is to use polyfit()
x = polyfit(v2, F, 1)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by