matlab怎麼去中心化
A. 為什麼我用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,這樣才行。
B. 如何在matlab中求非中心卡方分布的非中心化參數
如何在matlab中求非中心卡方分布的非中心化參數
中心卡方分布是標准正態分布的平方和,非中心卡方分布是均值為a,方差為b2的正態分布隨機變數的平方和;求的話看這兩個連接好了
C. 運行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)進行中心化和比例縮放,可以改善多項式及擬合演算法的數值特徵。
D. 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的說明,裡面公式很清晰了
E. 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)))])
結果:
F. 矩陣的中心化是什麼
使矩陣每列元素和為0,matlab中可以使用zscore(X)。
G. 求大神解答: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得到。
希望對你有幫助!
H. 急求FastICA 的源程序 matlab,包括數據的預處理(中心化和白化),注釋詳細點,謝謝!
% function [Ahat2, shat, n_iteration Test] = nc_fastica_svd(xold,typeStr,N,A)
function [shat Ahat2] = nc_fastica_svd(xold,typeStr,N)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% non-circular complex FastICA演算法,基於Newton迭代法,類似與fastICA
% ************************input***************************
% xold: 混合信號,m*n,m為陣元數,n為快拍數
% typeStr: 非線性函數,'log', 'kurt', or 'sqrt'
% **************************output**************************
% Ahat: 解混矩陣
% shat: 估計的源信號
% ********************************************************
% Reference
% Mike Novey and T. Adali, "On Extending the complex FastICA algorithm
% to noncircular sources" in
% (To appear 2007/2008) IEEE Journel on Signal Processing.,
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
type = 0;
if strcmp(typeStr,'log') == 1
type = 1;
elseif strcmp(typeStr,'kurt') == 1
type = 2;
elseif strcmp(typeStr,'sqrt') == 1
type = 3;
end
tol = 1e-5;
a2 = 0.1;
defl = 1; % components are estimated one by one in a deflationary manner; set this to 0 if you want them all estimated simultaneously
maxcounter = 50;
[n,m] = size(xold);
% Whitening of s:
yyy = zeros(1,m);
[Ex, Dx] = svd(cov(xold'));
E = Ex(:,1:N);
D = Dx(1:N,1:N);
Q = mtimes(sqrt(inv(D)),E');
x = Q * xold;
%Pseudo-covariance
pC = (x*transpose(x))/m;
% FIXED POINT ALGORITHM
W = eye(N);
Wold = zeros(N);
k = 0;
while (norm(abs(Wold'*W)-eye(N),'fro')>(N*1e-12) && k < 15*N)
k = k+1;
Wold = W;
for kk=1:N %Loop thru sources
yy = W(:,kk)'*x;
absy =abs(yy).^2;
%%Fixed point
if type == 1 %%log
g = 1./(a2 + absy);
gp = -1./(a2 + absy).^2;
elseif type == 2 %Kurt
g = absy;
gp = ones(size(absy));
elseif type == 3 %sqrt
g = 1./(2*sqrt(a2 + absy));
gp = -1./(4*(a2 + absy).^(3/2));
end
gRad = mean(ones(N,1)*(g.*conj(yy)).*x,2);
ggg = mean(gp.*absy + g);
B = mean(gp .* conj(yy).^2)*pC;
W(:,kk) = Wold(:,kk)*(ggg) -(gRad) + (B*conj(Wold(:,kk)));
end
%Orthonormalization
[E,D] = eig(W'*W);
W = W * E * inv(sqrt(D)) * E';
end; %Loop thru sources
n_iteration = k;
shat = W'*x; %Estimated sources
% Ahat1 = inv(Q)*W;
Ahat2 = W'*Q;
這個是NC-fastica,可以用。稍微注釋了些
原始程序,不知道是誰寫的了
I. 怎樣用matlab對圖像進行坐標原點中心CSDN
matlab圖像處理的話岡薩雷斯的書不大適合初學者呢,它適合學者去研究用。
其實你隨便在網上找找書都差不多。
主要的圖像處理方法就那麼幾種,初學者會顯示圖像,各種濾波,銳化,一些基礎應用就可以了~