matlab去中心化
① 求大神解答:matlab软件中center and scale x data是什么意思
你好
这句话的意思是将x data原始数据进行中心化与比例化处理。类似于线性插值技术。matlab在曲线拟合工具箱中加入这个选项是为了当X data与ydata拟合不好时,选择这个选项有利于得到更好的拟合效果。matlab通过正则化预测数据(Xdatal)的中心与比例,以有助于预测。具体实现过程如下:
x 是预测数据, μ 是 x的均值, σ 是x的标准差 .把xdata数据转换成z, 转换后的数据中心 为0, 标准差为 1.
经过centering and scaling后,求出的多项式系数是y与z的函数关系,与y与x关系不同。但是模型形式与残差范数没有变化。具体如何实现过程见matlab给出的比较代码:
loadcensus
x=cdate;
y=pop;
z=(x-mean(x))/std(x);%Computez-scoresofxdata
plot(x,y,'ro')%Plotdata
holdon
zfit=linspace(z(1),z(end),100);
pz=polyfit(z,y,3);%Computeconditionedfit
yfit=polyval(pz,zfit);
xfit=linspace(x(1),x(end),100);
plot(xfit,yfit,'b-')%Plotconditionedfitvs.xdata
处理后x与z数据的差异化见下图:
好处是能得到更加精确的拟合结果。
可也有缺点,得不到y与x的直接函数关系式,只能间接通过z得到。
希望对你有帮助!
② 为什么我用Matlab将一幅黑白图进行傅里叶变换后想对其频谱图逆变换显示出原图,却不行呢求高手指教
f = imread('tire.tif');
imshow(f)
F = fft2(f); % 傅氏变换
Fc = fftshift(F); % 中心化
Fm = abs(Fc); % 取模
figure, imshow(Fm, [ ])
figure, imshow(log(1+Fm), [ ]) % 对数变换,增强显示视觉效果
G = ifftshift(Fc); % 对Fc去中心化
g = ifft2(G); % 对G逆变换
figure, imshow(g) % 原图像
你要注意整个流程,f ---> F ----> Fc , 所以要回去的话当然是Fc --- > G --- > g,就是先对Fc去中心化得到G,再对G逆变换得到g,这样才行。
③ matlab中pca
1,4 matlab是有帮助文档的,我没有明白你所指的去中心化处理是什么,PCA的结果在数组自己的维度。
以下是帮助文档,请仔细阅读
coeff = pca(X) returns the principal component coefficients, also known as loadings, for the n-by-p data matrix X. Rows of X correspond to observations and columns correspond to variables. The coefficient matrix is p-by-p. Each column of coeffcontains coefficients for one principal component, and the columns are in descending order of component variance. By default, pca centers the data and uses the singular value decomposition (SVD) algorithm.
example
coeff = pca(X,Name,Value) returns any of the output arguments in the previous syntaxes using additional options for computation and handling of special data types, specified by one or more Name,Value pair arguments.
For example, you can specify the number of principal components pca returns or an algorithm other than SVD to use.
example
[coeff,score,latent] = pca(___) also returns the principal component scores in score and the principal component variances in latent. You can use any of the input arguments in the previous syntaxes.
Principal component scores are the representations of X in the principal component space. Rows of score correspond to observations, and columns correspond to components.
The principal component variances are the eigenvalues of the covariance matrix of X.
example
[coeff,score,latent,tsquared] = pca(___) also returns the Hotelling's T-squared statistic for each observation in X.
example
[coeff,score,latent,tsquared,explained,mu] = pca(___) also returns explained, the percentage of the total variance explained by each principal component and mu, the estimated mean of each variable in X.
2. PCA 和SVD的不同是,他们分解矩阵的方式是不同的。我建议你翻看wikipedia里面SVD和PCA的说明,里面公式很清晰了
④ 求Fastica在matlab中的源程序,包括数据的预处理(中心化和白化),很急,多谢了!
CSDN上都可以下载得到
⑤ 运行matlab中的polyfit多项式拟合函数,其中S的结果为R:[3x3 double] df:109 normr: 27.2741 都什么意思
实际上polyfit的意义就在于下面方程组的求解,未知数是p(1)~p(n+1)。
p1*x1^n+p2*x1^(n-1)+p3*x1^(n-2)+L+pn*x1+p(n+1)=y1
p1*x2^n+p2*x2^(n-1)+p3*x2^(n-2)+L+pn*x2+p(n+1)=y2
p1*xm^n+p2*xm^(n-1)+p3*xm^(n-2)+L+pn*xm+p(n+1)=ym
那么,上面的系数矩阵就是一个范德蒙矩阵V,矩阵表达式是V*p=y的求解。
背景完毕!了解了以上知识后,再来看这个结果的意义。
s是一个结构体数组(struct),包含了R,df和normr。
R:polyfit函数中,先根据输入的x构建范德蒙矩阵V,然后进行QR分解,得到的上三角矩阵
df:degrees of freedom, df=length(y)-(n+1)。df>0时,为超定方程组的求解,即拟合点数比未知数(p(1)~p(n+1))多
normr:norm of the resials,残差范数,normr=norm(y-V*p),此处的p为求解之后的数值。
mu=[mean(x); std(x)],通过xhat=(x-mu(1))/mu(2)进行中心化和比例缩放,可以改善多项式及拟合算法的数值特征。
⑥ MATLAB中通过函数 M 文件定义数组 X =[3,5,7,-6,8,7]求数组元素总数,最大值
定义一个test.m
X=[3,5,7,-6,8,7]';
disp(['元素个数:', num2str(length(X))])
disp(['最大元素:', num2str(max(max(X)))])
结果:
⑦ 如何在matlab中求非中心卡方分布的非中心化参数
如何在matlab中求非中心卡方分布的非中心化参数
中心卡方分布是标准正态分布的平方和,非中心卡方分布是均值为a,方差为b2的正态分布随机变量的平方和;求的话看这两个连接好了
⑧ 怎样用matlab对图像进行坐标原点中心CSDN
matlab图像处理的话冈萨雷斯的书不大适合初学者呢,它适合学者去研究用。
其实你随便在网上找找书都差不多。
主要的图像处理方法就那么几种,初学者会显示图像,各种滤波,锐化,一些基础应用就可以了~
⑨ 在matlab中N=zscore(data,0,2)是什么意思
在MATLAB中N=zscore(data,0,2)的作用是对data进行按列去量纲化(以标准差为分母)和中心化(以平均值为中心),参数“2”的意思是按行,参数“0”的意思是在求使用n而非n-1作为求标准差时的分母。
①
N=zscore(data,0,2)
和
②
N=(data-mean(data,2))./repmat(std(data,0,2),1,size(data,2))
的效果是一样的。