找一个二元一次方程matlab拟合程序,求一次系数和常数项的 10
y=[376.718,394.087,395.882,354.415,419.666,388.517,379.688,377.413,502.29,413.398,526...
y=[376.718,394.087,395.882,354.415,419.666,388.517,379.688,377.413,502.29,413.398,526.873,509.106,493.753,688.058,609.11,499.622,639.711,717.375,580.483,736.945,753.969,726.247]
x=[-5.407142857,-4.471428571,-1.971428571,-6.907142857,-2.285714286,-4.285714286,-1.285714286,-3.285714286,-7.707142857,-3.107142857,-3.464285714,-1.064285714,-3.364285714,-2.214285714,-2.007142857,7.992857143,-5.707142857,-1.357142857,7.642857143,-6.357142857,-5.035714286,-0.835714286]
方程y=a*x+b , 要求用matlab拟合出一次系数a和常数项b 展开
x=[-5.407142857,-4.471428571,-1.971428571,-6.907142857,-2.285714286,-4.285714286,-1.285714286,-3.285714286,-7.707142857,-3.107142857,-3.464285714,-1.064285714,-3.364285714,-2.214285714,-2.007142857,7.992857143,-5.707142857,-1.357142857,7.642857143,-6.357142857,-5.035714286,-0.835714286]
方程y=a*x+b , 要求用matlab拟合出一次系数a和常数项b 展开
展开全部
c=polyfit(x,y,1)
polyfit表示拟合多项式函数的意思。第三个参数1就是1次的意思。c中第一个是一次项系数,第二个是常数项系数。
多项式拟合都用的最小二乘法原理。
polyfit表示拟合多项式函数的意思。第三个参数1就是1次的意思。c中第一个是一次项系数,第二个是常数项系数。
多项式拟合都用的最小二乘法原理。
追问
你说的是没错,可我要能往matlab里输入的具体程序
追答
y=[376.718,394.087,395.882,354.415,419.666,388.517,379.688,377.413,502.29,413.398,526.873,509.106,493.753,688.058,609.11,499.622,639.711,717.375,580.483,736.945,753.969,726.247]
x=[-5.407142857,-4.471428571,-1.971428571,-6.907142857,-2.285714286,-4.285714286,-1.285714286,-3.285714286,-7.707142857,-3.107142857,-3.464285714,-1.064285714,-3.364285714,-2.214285714,-2.007142857,7.992857143,-5.707142857,-1.357142857,7.642857143,-6.357142857,-5.035714286,-0.835714286]
c=polyfit(x,y,1)
把上面代码直接放到commond里就好了啊?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询