matlab进行线性拟合(X,y):(20,-0.98106); (18,-0.88756); (16,-0.79372); (14,-068870);(12,-0.60286); (10,-0.50582); (8,-0.40675); (6,-0.30274);(4,-0.20746); (2,-0.10720); (0,-0.0034); (-2,0.10462);(-4,0.19790); (-6,0.30170); (-8,0.40362); (-10,0.50
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/06 13:22:05
![matlab进行线性拟合(X,y):(20,-0.98106); (18,-0.88756); (16,-0.79372); (14,-068870);(12,-0.60286); (10,-0.50582); (8,-0.40675); (6,-0.30274);(4,-0.20746); (2,-0.10720); (0,-0.0034); (-2,0.10462);(-4,0.19790); (-6,0.30170); (-8,0.40362); (-10,0.50](/uploads/image/z/7793457-33-7.jpg?t=matlab%E8%BF%9B%E8%A1%8C%E7%BA%BF%E6%80%A7%E6%8B%9F%E5%90%88%28X%2Cy%29%3A%2820%2C-0.98106%29%3B+%2818%2C-0.88756%29%3B+%2816%2C-0.79372%29%3B+%2814%2C-068870%29%3B%2812%2C-0.60286%29%3B+%2810%2C-0.50582%29%3B+%288%2C-0.40675%29%3B+%286%2C-0.30274%29%3B%284%2C-0.20746%29%3B+%282%2C-0.10720%29%3B+%280%2C-0.0034%29%3B+%28-2%2C0.10462%29%3B%28-4%2C0.19790%29%3B+%28-6%2C0.30170%29%3B+%28-8%2C0.40362%29%3B+%28-10%2C0.50)
matlab进行线性拟合(X,y):(20,-0.98106); (18,-0.88756); (16,-0.79372); (14,-068870);(12,-0.60286); (10,-0.50582); (8,-0.40675); (6,-0.30274);(4,-0.20746); (2,-0.10720); (0,-0.0034); (-2,0.10462);(-4,0.19790); (-6,0.30170); (-8,0.40362); (-10,0.50
matlab进行线性拟合
(X,y):(20,-0.98106); (18,-0.88756); (16,-0.79372); (14,-068870);
(12,-0.60286); (10,-0.50582); (8,-0.40675); (6,-0.30274);
(4,-0.20746); (2,-0.10720); (0,-0.0034); (-2,0.10462);
(-4,0.19790); (-6,0.30170); (-8,0.40362); (-10,0.50412);
(-12,0.60321); (-14,0.70614); (-16,0.80749); (-18,0.91196);
(-20,1.0157);
拟合一条直线y=kx 求出k的值,如何用matlab拟合,公式和步骤是什么?图形如何?
本人没有学过matlab,而这个又很急,
matlab进行线性拟合(X,y):(20,-0.98106); (18,-0.88756); (16,-0.79372); (14,-068870);(12,-0.60286); (10,-0.50582); (8,-0.40675); (6,-0.30274);(4,-0.20746); (2,-0.10720); (0,-0.0034); (-2,0.10462);(-4,0.19790); (-6,0.30170); (-8,0.40362); (-10,0.50
在Matlab里输入:
x=[20,18,16,14,12,10,8,6,4,2,0,-2,-4,-6,-8,-10,-12,-14,-16,-18,-20];
y=[-0.98106,-0.88756,-0.79372,-0.68870,-0.60286,-0.50582,-0.40675,-0.30274,-0.20746,-0.1072,-0.0034,0.10462,0.1979,0.3017,0.40362,0.50412,0.60321,0.70614,0.80749,0.91196,1.0157];
k=x'\y'
yy=k*x;
plot(x,y,x,yy,'r');
得到的结果是:
k =
-0.0501
红线是拟合后的值.
我把你的数据里面的第四个y的值068870改成了0.68870