当前位置:网站首页>Line fitting (least square method)
Line fitting (least square method)
2022-06-30 07:33:00 【RobotLife】
Linear equation :
y = a x + b y=ax+b y=ax+b
A set of data is obtained from the experimental test , Write it down as : ( x i , y i ) (x_i, y_i) (xi,yi)
Now we need to use the test data , Find the parameters of the linear equation a, b Make the straight line most consistent with the experimental data , Which is equivalent to the problem :
m i n a , b Σ [ y i − ( a x i + b ) ] 2 \underset{a, b}{min} \Sigma[y_i - (ax_i + b)]^2 a,bminΣ[yi−(axi+b)]2
remember :
sum= Σ [ y i − ( a x i + b ) ] 2 \Sigma[y_i - (ax_i + b)]^2 Σ[yi−(axi+b)]2
Yes a, b Derivation :
d s u m d a = Σ { − 2 x i [ y i − ( a x i + b ) ] } = 0 \frac{dsum}{da} = \Sigma\{-2x_i[y_i-(ax_i+b)]\} = 0 dadsum=Σ{ −2xi[yi−(axi+b)]}=0
d s u m d b = Σ { − 2 [ y i − ( a x i + b ) ] } = 0 \frac{dsum}{db}=\Sigma\{-2[y_i-(ax_i+b)]\} = 0 dbdsum=Σ{ −2[yi−(axi+b)]}=0
So we can get :
a = n Σ x i y i − Σ x i Σ y i n Σ x i 2 − ( Σ x i ) 2 a = \frac{n\Sigma x_iy_i - \Sigma x_i \Sigma y_i}{n\Sigma x_i^2 - (\Sigma x_i)^2} a=nΣxi2−(Σxi)2nΣxiyi−ΣxiΣyi
b = Σ y i − a Σ x i n b = \frac{\Sigma y_i - a\Sigma x_i}{n} b=nΣyi−aΣxi
among ,n The total number of data obtained for the test .
When n Σ x i 2 − ( Σ x i ) 2 = 0 n\Sigma x_i^2 - (\Sigma x_i)^2=0 nΣxi2−(Σxi)2=0 when , The slope of the line a To be big for nothing , non-existent , here , The linear equation is :
x = ( Σ x i ) / n x = (\Sigma x_i) / n x=(Σxi)/n
Resources for a,b The result of the coefficient is reversed , Therefore, the formula is reorganized .
Reference material :
https://wenku.baidu.com/view/d4ede28a910ef12d2af9e7e1.html
边栏推荐
- Video player (II): video decoding
- Network security - single arm routing, DHCP relay and ICMP Protocol
- Final review -php learning notes 8-mysql database
- halcon:读取摄像头并二值化
- 期末复习-PHP学习笔记3-PHP流程控制语句
- Firewall firewalld
- C language implements sequential queue, circular queue and chain queue
- Stm32g0 Tim interrupt use
- Minecraft 1.16.5 module development (50) guide book
- Network security - packet capture and IP packet header analysis
猜你喜欢
随机推荐
Cubemx completes STM32F103 dual serial port 485 transceiver transmission
Network, network card and IP configuration
Qtcreator debug code after configuring CDB debugger view variable value display card
Final review -php learning notes 8-mysql database
STM32 control LED lamp
Basic knowledge of system software development
nRF52832 GPIO LED
Account command and account authority
Network security - layer 3 switching technology and internal network planning
2022 retail industry strategy: three strategies for consumer goods gold digging (in depth)
网络安全-单臂路由、DHCP中继和ICMP协议
QT msvc2015 compiler reports an error: error: lnk1158: unable to run "rc.exe"
期末复习-PHP学习笔记6-字符串处理
Assembly learning register
342 maps covering exquisite knowledge, one of which is classic and pasted on the wall
Private method of single test calling object
The simulation interface does not declare an exception and throws an exception
Next initializesecuritycontext failed: unknown error (0x80092012) - the revocation function cannot check whether the certificate is revoked.
Raspberry pie trivial configuration
The most convenient serial port screen chip scheme designed at the charging pile in China








