求两个二维矩阵的root mean square(matlab程序)
2012-02-27 21:54
525 查看
function [rms,diffdata] = myRMS(udata, sdata) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This function computes the difference between the two data sets % udata and sdata (udata and sdata are of two dimension) after % udata has been scaled to have the same mean value as the sdata. % It then calculates the root mean square value of the difference . % % Make sure udata and sdata have the same size. % % The code is adapted from Bragi Sveinsson's mrFieldMap, function % mrFieldError. % % http://white.stanford.edu/teach/index.php/2009_Bragi_Sveinsson %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mysize = size(udata); if (mean(mean(udata)) == 0) udata_i_scaled = udata; else udata_i_scaled = mean(mean(sdata))/mean(mean(udata))*udata; end diffdata = sdata - udata_i_scaled; if sum(sum(diffdata.^2))==0 rms = 0; else rms = sqrt(1/(mysize(1)*mysize(2))*sum(sum(diffdata.^2))); end
相关文章推荐
- MATLAB中查找两个不同维度的矩阵中相同或者不同元素的位置
- 二维光子晶体带隙仿真Matlab完全程序_平面波展开法
- C/C++小程序学习:二维矩阵行列元素互换
- matlab中可视化二维矩阵 imagesc
- 扫描网格边界的方法/二维矩阵,使程序比较简短。
- Matlab中两个矩阵相乘报错:MTIMES is not fully supported for integer classes. At least one input must be scalar
- matlab meshgrid函数生成二维网格矩阵举例讲解
- 二维分数阶Fouirer变换matlab程序
- matlab练习程序(二维直方图)
- matlab 二维矩阵输出到文件 文件名为变量
- matlab 判断两个矩阵是否相等
- 在Matlab中,想要将两个字符串连接在一起,有以下的方法: 假定有两个字符串 >> str1='Iloveyou';str2='123'; 方法一:用中括号将str1和str2像矩阵元素一样包含起来
- LeetCode: 221_Maximal Square | 二维0-1矩阵中计算包含1的最大正方形的面积 | Medium
- 一分钟了解“Matlab求两个矩阵的相关程度corr2”
- Matlab中特征向量间距离矩阵的并行mex程序
- Matlab中特征向量间距离矩阵的并行mex程序
- 基于MATLAB的线性代数 化简为阶梯形矩阵(两个矩阵)
- 图像化矩阵Matlab程序
- MATLAB中对一个二维矩阵画三维图
- matlab练习程序(构建Hessian矩阵)