⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcr_three_modes.m

📁 GUI for Multivariate Image Analysis of 4-dimensional data (Matlab Code)
💻 M
字号:
function [scores, load1, load2]=mcr_three_modes(data,Ncomp);
% function [scores, loads1, loads2]=mcr_three_modes(data,Ncomp);
%
% function for calculating MCR results in three modes for multispectral
% image data set
% score images and loading profiles in 2 other modes are calculated using
% als_ka function;
% type help als_ka for help on type of MCR constraints used.
%
% created by K.Artyushkova
% kartyush@unm.edu
% February 2005

%% opening data
[n,m,p,q]=size(data);
data2=reshape(data,[n*m, p,q]);

%% to get score images
data_row=reshape(data2,[n*m p*q]); 
H = progressbar('create', ['MCR'], ['wait while scores are calculated']);
[copt,sopt]=als_ka(data_row,Ncomp,q, 2, p);
scores=reshape(copt,[n m Ncomp]);

%% to get profiles in mode 2
data_column=reshape(data2, [n*m*q p]); %colomn-wise
progressbar('message', H, 'wait while loadings in mode 1 are calculated')
[copt,sopt]=als_ka(data_column,Ncomp,q, 1, p);
load2=sopt';

%% to get profiles in mode 1
  for i=1:p
    data_flip(:,:,:,i)=data(:,:,i,:);
  end
[n1,m1,p1,q1]=size(data_flip);
data2_f=reshape(data_flip,[n1*m1, p1,q1]);
data_column2=reshape(data2_f,[n1*m1*q1 p1]);
progressbar('message', H, 'wait while loadings in mode 1 are calculated')
[copt,sopt]=als_ka(data_column2,Ncomp,q1, 1, p1);
load1=sopt';
progressbar('kill', H) 

%% plot results
H.Position=[761 43 285 577];
figure(H)
subplot(2,1,1)
plot(load1)
xlabel('variable1')
subplot(2,1,2)
plot(load2)
xlabel('variable2')
subplot(2,1,1)
title(['MCR results'])

H.Position=[479 43 276 577];
figure(H)
[a,b,c]=size(scores);
for i=1:c
    subplot(c,1,i)
    imagesc(scores(:,:,i)), colormap (gray)
end
subplot(c,1,1)
title(['MCR results'])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -