matlab Cartesian,Matlab - Standard Deviation of Cartesian Points
问题
I have an array of cartesian points (column 1 is x values and column 2 is y values) like so:
308 522
307 523
307 523
307 523
307 523
307 523
306 523
How would I go about getting a standard deviation of the points? It would be compared to the mean, which would be a straight line. The points are not that straight line, so then the standard deviation describes how wavy or "off-base" from the straight line the line segment is.
I really appreciate the help.
回答1:
If you are certain the xy data describe a straight line, you'd do the following.
Finding the best fitting straight line equals solving the over-determined linear system Ax = b in a least-squares sense, where
xy = [
308 522
307 523
307 523
307 523
307 523
307 523
306 523];
x_vals = xy(:,1);
y_vals = xy(:,2);
A = [x_vals ones(size(x_vals))];
b = y_vals;
This can be done in Matlab like so:
sol = A\b;
m = sol(1);
c = sol(2);
What we've done now is find the values for m and c so that the line described by the equation y = mx+c best-fits the data you've given. This best-fit line is not perfect, so it has errors w.r.t. the y-data:
errs = (m*x_vals + c) - y_vals;
The standard deviation of these errors can be computed like so:
>> std(errs)
ans =
0.2440
If you want to use the perpendicular distance to the line (Euclidian distance), you'll have to include a geometric factor:
errs = (m*x_vals + c) - y;
errs_perpendicular = errs * cos(atan(m));
Using trig identities this can be reworked to
errs_perpendicular = errs * 1/sqrt(1+m*m);
and of course,
>> std(errs_perpendicular)
ans =
0.2182
If you are not certain that a straight line fits through the data and/or your xy data essentially describe a point cloud around some common centre, you'd do the following.
Find the center of mass (COM):
COM = mean(xy);
the distances of all points to the COM:
dists = sqrt(sum(bsxfun(@minus, COM, xy).^2,2));
and the standard deviation thereof:
>> std(dists)
ans =
0.5059
回答2:
The mean of a set of two-dimensional values is another two-dimensional value, i.e. it's a point, not a line. This point is also known as the centre of mass, I believe.
It's not entirely clear what standard deviation is in this case, but I think it would make sense to define it in terms of distance from the mean.
来源:https://stackoverflow.com/questions/12736336/matlab-standard-deviation-of-cartesian-points
matlab Cartesian,Matlab - Standard Deviation of Cartesian Points相关推荐
- matlab intergral,matlab學習:人臉識別之HOG(Histograms of Oriented Gradients)
HOG descriptors 是應用在計算機視覺和圖像處理領域,用於目標檢測的特征描述器.這項技術是用來計算局部圖像梯度的方向信息的統計值.這種方法跟邊緣方向直方圖(edge orientation ...
- makemid+matlab,《MATLAB基础》双语课
MATLAB双语教学视频第17讲 MATLAB双语教学视频第18讲 Summarizing Data In this section... "Overview" on page 5 ...
- Standard Deviation And Correlation
2019独角兽企业重金招聘Python工程师标准>>> 1: Introduction In this mission, we'll be calculating statistic ...
- c++引用matlab类,matlab调用C++函数浅谈(一)
由于在下才疏学浅,在网上看各高手指南时亦觉云里雾里,遂决定一切说明从最基础说起,一是方便自己(记性奇差),二是方便似我的小白.以下部分是我从各网站论坛等摘抄.重组.改写过的,以求更加详实明朗,由于参考 ...
- R语言sd函数计算数值标准差实战(Standard Deviation)
R语言sd函数计算数值标准差实战(Standard Deviation) 目录 R语言sd函数计算数值标准差实战(Standard Deviation) #基本语法 #sd
- 磁盘驱动读取系统MATLAB仿真,matlab读写..doc
matlab读写. MATLAB二进制数据文件的读写 (2011-06-04 19:44:27) 转载▼ 标签: easleyhux matlab 二进制读写 杂谈分类: MATLAB 所谓二进制格式 ...
- 【 MATLAB 】MATLAB 实现模拟信号采样后的重建(三)一阶保持(FOH)内插
上篇博文采用了零阶保持(ZOH)的方式进行了重构:[ MATLAB ]MATLAB 实现模拟信号采样后的重建(二)零阶保持(ZOH) 这篇博文我们使用一阶保持(FOH)内插来重建信号,采用的案例依然是 ...
- 【 MATLAB 】MATLAB 实现模拟信号采样后的重建(二)零阶保持(ZOH)
上篇博文采样sinc函数内插的方式实现了模拟信号的重建:[ MATLAB ]MATLAB 实现模拟信号采样后的重建(一) 这篇博文我们使用零阶保持器(ZOH)来重建信号,采用的案例依然是上篇博文中的案 ...
- 关于各种回归评价指标MSE、RMSE、MAE、R-Squared、Standard Deviation(标准差)
分类问题的评价指标是准确率,那么回归算法的评价指标就是MSE,RMSE,MAE.R-Squared.下面一一介绍: 1.均方误差(MSE) MSE (Mean Squared Error)叫做均方误差 ...
最新文章
- JDBC:使用连接池管理连接
- linux基础命令练习,Linux常用命令练习
- cadence安装完怎么打开_Linux 环境下Vivado与Cadence仿真工具联合仿真环境的搭建
- oracle如何带符号求和,ORACLE 实现行转列(字符串求和)
- [vue] 开发过程中有使用过devtools吗?
- 用chrome模拟微信浏览器访问需要OAuth2.0网页授权的页面
- 华为系列设备优先级总结(二)
- vos3000下载java_VOS3000 安装
- 轻量级数据格式 —— JSON
- 计算机技术对股市的影响,cpi上涨对股市影响有哪些?CPI如何影响股市涨跌
- 机器学习 | 台大林轩田机器学习基石课程笔记5 --- Training versus Testing
- excel不显示0_Excel教程:数值为0不显示的三种解决方法
- 安卓小游戏:小板弹球
- 文件上传之500错误
- 用计算机写文章 单元备课,备课写教案
- 计算机的桌面不见了,桌面上的图标不见了怎么办-电脑桌面图标不见了电脑屏幕桌面不见了,怎么办? 爱问知识人...
- linux反复出现文件系统损坏,Linux日常维护之文件系统损坏后的修复
- 谈谈个人网站的建立(五)—— 小集群的部署
- 国密算法Go语言实现(详解)(九) ——SM2(椭圆曲线公钥密码算法)
- HCIE 面试资料-BFD/NSF/NSR/NTP