怎样实现过固定点的1次线性拟合?。

实验得到一系列数据,已经做出散点图,怎样实现过固定点的1次线性拟合?用polyval函数可以吗?或者怎样在cftool中操作,请大神指点。

 채택된 답변

tikiceg
tikiceg 2022년 10월 28일

0 개 추천

举个例子吧:
x=[1:10]';
y=[ 6.7    8.7    9.8   10.8   12.5  15.1 17.9  20.2  21.5    22.4]'
x=[ones(numel(x),1),x]
opts = optimoptions('lsqlin','Algorithm','active-set');
para=lsqlin(x,y,[],[],[1 6],16,[],[],[],opts)
para(1)是常数项,para(2)是一次项,过点(6,16)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

태그

질문:

2022년 10월 28일

답변:

2022년 10월 28일

Community Treasure Hunt

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

Start Hunting!